Botan  2.6.0
Crypto and TLS for C++11
Public Member Functions | Friends | List of all members
Botan::donna128 Class Referencefinal

#include <donna128.h>

Public Member Functions

 donna128 (uint64_t ll=0, uint64_t hh=0)
 
 donna128 (const donna128 &)=default
 
uint64_t hi () const
 
uint64_t lo () const
 
uint64_t operator &= (uint64_t mask)
 
donna128operator+= (const donna128 &x)
 
donna128operator+= (uint64_t x)
 
donna128operator= (const donna128 &)=default
 

Friends

uint64_t operator & (const donna128 &x, uint64_t mask)
 
donna128 operator<< (const donna128 &x, size_t shift)
 
donna128 operator>> (const donna128 &x, size_t shift)
 

Detailed Description

Definition at line 15 of file donna128.h.

Constructor & Destructor Documentation

◆ donna128() [1/2]

Botan::donna128::donna128 ( uint64_t  ll = 0,
uint64_t  hh = 0 
)
inline

Definition at line 18 of file donna128.h.

18 { l = ll; h = hh; }

◆ donna128() [2/2]

Botan::donna128::donna128 ( const donna128 )
default

Member Function Documentation

◆ hi()

uint64_t Botan::donna128::hi ( ) const
inline

Definition at line 78 of file donna128.h.

Referenced by Botan::operator*(), and Botan::operator|().

78 { return h; }

◆ lo()

uint64_t Botan::donna128::lo ( ) const
inline

Definition at line 77 of file donna128.h.

Referenced by Botan::combine_lower(), Botan::operator*(), and Botan::operator|().

77 { return l; }

◆ operator &=()

uint64_t Botan::donna128::operator&= ( uint64_t  mask)
inline

Definition at line 52 of file donna128.h.

53  {
54  h = 0;
55  l &= mask;
56  return l;
57  }

◆ operator+=() [1/2]

donna128& Botan::donna128::operator+= ( const donna128 x)
inline

Definition at line 59 of file donna128.h.

References Botan::carry().

60  {
61  l += x.l;
62  h += x.h;
63 
64  const uint64_t carry = (l < x.l);
65  h += carry;
66  return *this;
67  }
void carry(int64_t &h0, int64_t &h1)

◆ operator+=() [2/2]

donna128& Botan::donna128::operator+= ( uint64_t  x)
inline

Definition at line 69 of file donna128.h.

References Botan::carry().

70  {
71  l += x;
72  const uint64_t carry = (l < x);
73  h += carry;
74  return *this;
75  }
void carry(int64_t &h0, int64_t &h1)

◆ operator=()

donna128& Botan::donna128::operator= ( const donna128 )
default

Friends And Related Function Documentation

◆ operator &

uint64_t operator& ( const donna128 x,
uint64_t  mask 
)
friend

Definition at line 47 of file donna128.h.

48  {
49  return x.l & mask;
50  }

◆ operator<<

donna128 operator<< ( const donna128 x,
size_t  shift 
)
friend

Definition at line 35 of file donna128.h.

36  {
37  donna128 z = x;
38  if(shift > 0)
39  {
40  const uint64_t carry = z.l >> (64 - shift);
41  z.l = (z.l << shift);
42  z.h = (z.h << shift) | carry;
43  }
44  return z;
45  }
donna128(uint64_t ll=0, uint64_t hh=0)
Definition: donna128.h:18
void carry(int64_t &h0, int64_t &h1)

◆ operator>>

donna128 operator>> ( const donna128 x,
size_t  shift 
)
friend

Definition at line 23 of file donna128.h.

24  {
25  donna128 z = x;
26  if(shift > 0)
27  {
28  const uint64_t carry = z.h << (64 - shift);
29  z.h = (z.h >> shift);
30  z.l = (z.l >> shift) | carry;
31  }
32  return z;
33  }
donna128(uint64_t ll=0, uint64_t hh=0)
Definition: donna128.h:18
void carry(int64_t &h0, int64_t &h1)

The documentation for this class was generated from the following file: