Botan 3.3.0
Crypto and TLS for C&
Public Member Functions | Friends | List of all members
Botan::donna128 Class Referencefinal

#include <donna128.h>

Public Member Functions

 donna128 (const donna128 &)=default
 
 donna128 (uint64_t ll=0, uint64_t hh=0)
 
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 17 of file donna128.h.

17 {
18 l = ll;
19 h = hh;
20 }

◆ donna128() [2/2]

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

Member Function Documentation

◆ hi()

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

Definition at line 71 of file donna128.h.

71{ return h; }

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

◆ lo()

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

Definition at line 69 of file donna128.h.

69{ return l; }

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

◆ operator&=()

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

Definition at line 47 of file donna128.h.

47 {
48 h = 0;
49 l &= mask;
50 return l;
51 }

◆ operator+=() [1/2]

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

Definition at line 53 of file donna128.h.

53 {
54 l += x.l;
55 h += x.h;
56
57 const uint64_t carry = (l < x.l);
58 h += carry;
59 return *this;
60 }
void carry(int64_t &h0, int64_t &h1)

References Botan::carry().

◆ operator+=() [2/2]

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

Definition at line 62 of file donna128.h.

62 {
63 l += x;
64 const uint64_t carry = (l < x);
65 h += carry;
66 return *this;
67 }

References Botan::carry().

◆ operator=()

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

Friends And Related Symbol Documentation

◆ operator&

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

Definition at line 45 of file donna128.h.

45{ return x.l & mask; }

◆ operator<<

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

Definition at line 35 of file donna128.h.

35 {
36 donna128 z = x;
37 if(shift > 0) {
38 const uint64_t carry = z.l >> (64 - shift);
39 z.l = (z.l << shift);
40 z.h = (z.h << shift) | carry;
41 }
42 return z;
43 }
donna128(uint64_t ll=0, uint64_t hh=0)
Definition donna128.h:17

◆ operator>>

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

Definition at line 25 of file donna128.h.

25 {
26 donna128 z = x;
27 if(shift > 0) {
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 }

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