Bitcoin Core 28.99.0
P2P Digital Currency
Public Member Functions | Protected Attributes | Static Protected Attributes | Friends | List of all members
base_uint< BITS > Class Template Reference

Template base class for unsigned big integers. More...

#include <arith_uint256.h>

Public Member Functions

 base_uint ()
 
 base_uint (const base_uint &b)
 
base_uintoperator= (const base_uint &b)
 
 base_uint (uint64_t b)
 
base_uint operator~ () const
 
base_uint operator- () const
 
double getdouble () const
 
base_uintoperator= (uint64_t b)
 
base_uintoperator^= (const base_uint &b)
 
base_uintoperator&= (const base_uint &b)
 
base_uintoperator|= (const base_uint &b)
 
base_uintoperator^= (uint64_t b)
 
base_uintoperator|= (uint64_t b)
 
base_uintoperator<<= (unsigned int shift)
 
base_uintoperator>>= (unsigned int shift)
 
base_uintoperator+= (const base_uint &b)
 
base_uintoperator-= (const base_uint &b)
 
base_uintoperator+= (uint64_t b64)
 
base_uintoperator-= (uint64_t b64)
 
base_uintoperator*= (uint32_t b32)
 
base_uintoperator*= (const base_uint &b)
 
base_uintoperator/= (const base_uint &b)
 
base_uintoperator++ ()
 
base_uint operator++ (int)
 
base_uintoperator-- ()
 
base_uint operator-- (int)
 
int CompareTo (const base_uint &b) const
 Numeric ordering (unlike base_blob::Compare) More...
 
bool EqualTo (uint64_t b) const
 
std::string GetHex () const
 Hex encoding of the number (with the most significant digits first). More...
 
std::string ToString () const
 
unsigned int size () const
 
unsigned int bits () const
 Returns the position of the highest bit set plus one, or zero if the value is zero. More...
 
uint64_t GetLow64 () const
 

Protected Attributes

uint32_t pn [WIDTH]
 Big integer represented with 32-bit digits, least-significant first. More...
 

Static Protected Attributes

static constexpr int WIDTH = BITS / 32
 

Friends

base_uint operator+ (const base_uint &a, const base_uint &b)
 
base_uint operator- (const base_uint &a, const base_uint &b)
 
base_uint operator* (const base_uint &a, const base_uint &b)
 
base_uint operator/ (const base_uint &a, const base_uint &b)
 
base_uint operator| (const base_uint &a, const base_uint &b)
 
base_uint operator& (const base_uint &a, const base_uint &b)
 
base_uint operator^ (const base_uint &a, const base_uint &b)
 
base_uint operator>> (const base_uint &a, int shift)
 
base_uint operator<< (const base_uint &a, int shift)
 
base_uint operator* (const base_uint &a, uint32_t b)
 
bool operator== (const base_uint &a, const base_uint &b)
 
bool operator!= (const base_uint &a, const base_uint &b)
 
bool operator> (const base_uint &a, const base_uint &b)
 
bool operator< (const base_uint &a, const base_uint &b)
 
bool operator>= (const base_uint &a, const base_uint &b)
 
bool operator<= (const base_uint &a, const base_uint &b)
 
bool operator== (const base_uint &a, uint64_t b)
 
bool operator!= (const base_uint &a, uint64_t b)
 

Detailed Description

template<unsigned int BITS>
class base_uint< BITS >

Template base class for unsigned big integers.

Definition at line 24 of file arith_uint256.h.

Constructor & Destructor Documentation

◆ base_uint() [1/3]

template<unsigned int BITS>
base_uint< BITS >::base_uint ( )
inline

Definition at line 33 of file arith_uint256.h.

◆ base_uint() [2/3]

template<unsigned int BITS>
base_uint< BITS >::base_uint ( const base_uint< BITS > &  b)
inline

Definition at line 39 of file arith_uint256.h.

◆ base_uint() [3/3]

template<unsigned int BITS>
base_uint< BITS >::base_uint ( uint64_t  b)
inline

Definition at line 54 of file arith_uint256.h.

Member Function Documentation

◆ bits()

template<unsigned int BITS>
unsigned int base_uint< BITS >::bits

Returns the position of the highest bit set plus one, or zero if the value is zero.

Definition at line 156 of file arith_uint256.cpp.

Here is the caller graph for this function:

◆ CompareTo()

template<unsigned int BITS>
int base_uint< BITS >::CompareTo ( const base_uint< BITS > &  b) const

Numeric ordering (unlike base_blob::Compare)

Definition at line 102 of file arith_uint256.cpp.

◆ EqualTo()

template<unsigned int BITS>
bool base_uint< BITS >::EqualTo ( uint64_t  b) const

Definition at line 114 of file arith_uint256.cpp.

◆ getdouble()

template<unsigned int BITS>
double base_uint< BITS >::getdouble

Definition at line 128 of file arith_uint256.cpp.

Here is the caller graph for this function:

◆ GetHex()

template<unsigned int BITS>
std::string base_uint< BITS >::GetHex

Hex encoding of the number (with the most significant digits first).

Definition at line 140 of file arith_uint256.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ GetLow64()

template<unsigned int BITS>
uint64_t base_uint< BITS >::GetLow64 ( ) const
inline

Definition at line 238 of file arith_uint256.h.

Here is the caller graph for this function:

◆ operator&=()

template<unsigned int BITS>
base_uint & base_uint< BITS >::operator&= ( const base_uint< BITS > &  b)
inline

Definition at line 97 of file arith_uint256.h.

◆ operator*=() [1/2]

template<unsigned int BITS>
base_uint< BITS > & base_uint< BITS >::operator*= ( const base_uint< BITS > &  b)

Definition at line 60 of file arith_uint256.cpp.

◆ operator*=() [2/2]

template<unsigned int BITS>
base_uint< BITS > & base_uint< BITS >::operator*= ( uint32_t  b32)

Definition at line 48 of file arith_uint256.cpp.

◆ operator++() [1/2]

template<unsigned int BITS>
base_uint & base_uint< BITS >::operator++ ( )
inline

Definition at line 166 of file arith_uint256.h.

◆ operator++() [2/2]

template<unsigned int BITS>
base_uint base_uint< BITS >::operator++ ( int  )
inline

Definition at line 175 of file arith_uint256.h.

◆ operator+=() [1/2]

template<unsigned int BITS>
base_uint & base_uint< BITS >::operator+= ( const base_uint< BITS > &  b)
inline

Definition at line 128 of file arith_uint256.h.

◆ operator+=() [2/2]

template<unsigned int BITS>
base_uint & base_uint< BITS >::operator+= ( uint64_t  b64)
inline

Definition at line 146 of file arith_uint256.h.

◆ operator-()

template<unsigned int BITS>
base_uint base_uint< BITS >::operator- ( ) const
inline

Definition at line 70 of file arith_uint256.h.

◆ operator--() [1/2]

template<unsigned int BITS>
base_uint & base_uint< BITS >::operator-- ( )
inline

Definition at line 183 of file arith_uint256.h.

◆ operator--() [2/2]

template<unsigned int BITS>
base_uint base_uint< BITS >::operator-- ( int  )
inline

Definition at line 192 of file arith_uint256.h.

◆ operator-=() [1/2]

template<unsigned int BITS>
base_uint & base_uint< BITS >::operator-= ( const base_uint< BITS > &  b)
inline

Definition at line 140 of file arith_uint256.h.

◆ operator-=() [2/2]

template<unsigned int BITS>
base_uint & base_uint< BITS >::operator-= ( uint64_t  b64)
inline

Definition at line 154 of file arith_uint256.h.

◆ operator/=()

template<unsigned int BITS>
base_uint< BITS > & base_uint< BITS >::operator/= ( const base_uint< BITS > &  b)

Definition at line 76 of file arith_uint256.cpp.

◆ operator<<=()

template<unsigned int BITS>
base_uint< BITS > & base_uint< BITS >::operator<<= ( unsigned int  shift)

Definition at line 1 of file arith_uint256.cpp.

◆ operator=() [1/2]

template<unsigned int BITS>
base_uint & base_uint< BITS >::operator= ( const base_uint< BITS > &  b)
inline

Definition at line 45 of file arith_uint256.h.

◆ operator=() [2/2]

template<unsigned int BITS>
base_uint & base_uint< BITS >::operator= ( uint64_t  b)
inline

Definition at line 81 of file arith_uint256.h.

◆ operator>>=()

template<unsigned int BITS>
base_uint< BITS > & base_uint< BITS >::operator>>= ( unsigned int  shift)

Definition at line 31 of file arith_uint256.cpp.

◆ operator^=() [1/2]

template<unsigned int BITS>
base_uint & base_uint< BITS >::operator^= ( const base_uint< BITS > &  b)
inline

Definition at line 90 of file arith_uint256.h.

◆ operator^=() [2/2]

template<unsigned int BITS>
base_uint & base_uint< BITS >::operator^= ( uint64_t  b)
inline

Definition at line 111 of file arith_uint256.h.

◆ operator|=() [1/2]

template<unsigned int BITS>
base_uint & base_uint< BITS >::operator|= ( const base_uint< BITS > &  b)
inline

Definition at line 104 of file arith_uint256.h.

◆ operator|=() [2/2]

template<unsigned int BITS>
base_uint & base_uint< BITS >::operator|= ( uint64_t  b)
inline

Definition at line 118 of file arith_uint256.h.

◆ operator~()

template<unsigned int BITS>
base_uint base_uint< BITS >::operator~ ( ) const
inline

Definition at line 62 of file arith_uint256.h.

◆ size()

template<unsigned int BITS>
unsigned int base_uint< BITS >::size ( ) const
inline

Definition at line 227 of file arith_uint256.h.

Here is the caller graph for this function:

◆ ToString()

template<unsigned int BITS>
std::string base_uint< BITS >::ToString

Definition at line 150 of file arith_uint256.cpp.

Here is the caller graph for this function:

Friends And Related Function Documentation

◆ operator!= [1/2]

template<unsigned int BITS>
bool operator!= ( const base_uint< BITS > &  a,
const base_uint< BITS > &  b 
)
friend

Definition at line 215 of file arith_uint256.h.

◆ operator!= [2/2]

template<unsigned int BITS>
bool operator!= ( const base_uint< BITS > &  a,
uint64_t  b 
)
friend

Definition at line 221 of file arith_uint256.h.

◆ operator&

template<unsigned int BITS>
base_uint operator& ( const base_uint< BITS > &  a,
const base_uint< BITS > &  b 
)
friend

Definition at line 209 of file arith_uint256.h.

◆ operator* [1/2]

template<unsigned int BITS>
base_uint operator* ( const base_uint< BITS > &  a,
const base_uint< BITS > &  b 
)
friend

Definition at line 206 of file arith_uint256.h.

◆ operator* [2/2]

template<unsigned int BITS>
base_uint operator* ( const base_uint< BITS > &  a,
uint32_t  b 
)
friend

Definition at line 213 of file arith_uint256.h.

◆ operator+

template<unsigned int BITS>
base_uint operator+ ( const base_uint< BITS > &  a,
const base_uint< BITS > &  b 
)
friend

Definition at line 204 of file arith_uint256.h.

◆ operator-

template<unsigned int BITS>
base_uint operator- ( const base_uint< BITS > &  a,
const base_uint< BITS > &  b 
)
friend

Definition at line 205 of file arith_uint256.h.

◆ operator/

template<unsigned int BITS>
base_uint operator/ ( const base_uint< BITS > &  a,
const base_uint< BITS > &  b 
)
friend

Definition at line 207 of file arith_uint256.h.

◆ operator<

template<unsigned int BITS>
bool operator< ( const base_uint< BITS > &  a,
const base_uint< BITS > &  b 
)
friend

Definition at line 217 of file arith_uint256.h.

◆ operator<<

template<unsigned int BITS>
base_uint operator<< ( const base_uint< BITS > &  a,
int  shift 
)
friend

Definition at line 212 of file arith_uint256.h.

◆ operator<=

template<unsigned int BITS>
bool operator<= ( const base_uint< BITS > &  a,
const base_uint< BITS > &  b 
)
friend

Definition at line 219 of file arith_uint256.h.

◆ operator== [1/2]

template<unsigned int BITS>
bool operator== ( const base_uint< BITS > &  a,
const base_uint< BITS > &  b 
)
friend

Definition at line 214 of file arith_uint256.h.

◆ operator== [2/2]

template<unsigned int BITS>
bool operator== ( const base_uint< BITS > &  a,
uint64_t  b 
)
friend

Definition at line 220 of file arith_uint256.h.

◆ operator>

template<unsigned int BITS>
bool operator> ( const base_uint< BITS > &  a,
const base_uint< BITS > &  b 
)
friend

Definition at line 216 of file arith_uint256.h.

◆ operator>=

template<unsigned int BITS>
bool operator>= ( const base_uint< BITS > &  a,
const base_uint< BITS > &  b 
)
friend

Definition at line 218 of file arith_uint256.h.

◆ operator>>

template<unsigned int BITS>
base_uint operator>> ( const base_uint< BITS > &  a,
int  shift 
)
friend

Definition at line 211 of file arith_uint256.h.

◆ operator^

template<unsigned int BITS>
base_uint operator^ ( const base_uint< BITS > &  a,
const base_uint< BITS > &  b 
)
friend

Definition at line 210 of file arith_uint256.h.

◆ operator|

template<unsigned int BITS>
base_uint operator| ( const base_uint< BITS > &  a,
const base_uint< BITS > &  b 
)
friend

Definition at line 208 of file arith_uint256.h.

Member Data Documentation

◆ pn

template<unsigned int BITS>
uint32_t base_uint< BITS >::pn[WIDTH]
protected

Big integer represented with 32-bit digits, least-significant first.

Definition at line 30 of file arith_uint256.h.

◆ WIDTH

template<unsigned int BITS>
constexpr int base_uint< BITS >::WIDTH = BITS / 32
staticconstexprprotected

Definition at line 28 of file arith_uint256.h.


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