PRCYCoin  2.0.0.7rc1
P2P Digital Currency
Public Types | Public Member Functions | Public 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 Types

enum  { WIDTH =BITS/32 }
 

Public Member Functions

 base_uint ()
 
 base_uint (const base_uint &b)
 
base_uintoperator= (const base_uint &b)
 
 base_uint (uint64_t b)
 
 base_uint (const std::string &str)
 
 base_uint (const std::vector< unsigned char > &vch)
 
bool operator! () const
 
const base_uint operator~ () const
 
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++ ()
 
const base_uint operator++ (int)
 
base_uintoperator-- ()
 
const base_uint operator-- (int)
 
int CompareTo (const base_uint &b) const
 
bool EqualTo (uint64_t b) const
 
std::string GetHex () const
 
void SetHex (const char *psz)
 
void SetHex (const std::string &str)
 
std::string ToString () const
 
std::string ToStringReverseEndian () const
 
unsigned char * begin ()
 
unsigned char * end ()
 
const unsigned char * begin () const
 
const unsigned char * end () const
 
unsigned int size () const
 
uint64_t Get64 (int n=0) const
 
uint32_t Get32 (int n=0) 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
 
unsigned int GetSerializeSize (int nType, int nVersion) const
 
template<typename Stream >
void Serialize (Stream &s, int nType, int nVersion) const
 
template<typename Stream >
void Unserialize (Stream &s, int nType, int nVersion)
 
uint64_t GetCheapHash () const
 
void SetNull ()
 
bool IsNull () const
 

Public Attributes

uint32_t pn [WIDTH]
 

Friends

class uint160
 
class uint256
 
class uint512
 
class arith_uint160
 
class arith_uint256
 
class arith_uint512
 
const friend base_uint operator+ (const base_uint &a, const base_uint &b)
 
const friend base_uint operator- (const base_uint &a, const base_uint &b)
 
const friend base_uint operator* (const base_uint &a, const base_uint &b)
 
const friend base_uint operator/ (const base_uint &a, const base_uint &b)
 
const friend base_uint operator| (const base_uint &a, const base_uint &b)
 
const friend base_uint operator& (const base_uint &a, const base_uint &b)
 
const friend base_uint operator^ (const base_uint &a, const base_uint &b)
 
const friend base_uint operator>> (const base_uint &a, int shift)
 
const friend base_uint operator<< (const base_uint &a, int shift)
 
const friend 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 30 of file arith_uint256.h.

Member Enumeration Documentation

◆ anonymous enum

template<unsigned int BITS>
anonymous enum
Enumerator
WIDTH 

Definition at line 33 of file arith_uint256.h.

Constructor & Destructor Documentation

◆ base_uint() [1/5]

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

Definition at line 36 of file arith_uint256.h.

◆ base_uint() [2/5]

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

Definition at line 42 of file arith_uint256.h.

◆ base_uint() [3/5]

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

Definition at line 55 of file arith_uint256.h.

◆ base_uint() [4/5]

template<unsigned int BITS>
base_uint< BITS >::base_uint ( const std::string &  str)
explicit

Definition at line 15 of file arith_uint256.cpp.

◆ base_uint() [5/5]

template<unsigned int BITS>
base_uint< BITS >::base_uint ( const std::vector< unsigned char > &  vch)
explicit

Definition at line 21 of file arith_uint256.cpp.

Member Function Documentation

◆ begin() [1/2]

template<unsigned int BITS>
unsigned char* base_uint< BITS >::begin ( )
inline

Definition at line 240 of file arith_uint256.h.

Here is the caller graph for this function:

◆ begin() [2/2]

template<unsigned int BITS>
const unsigned char* base_uint< BITS >::begin ( ) const
inline

Definition at line 250 of file arith_uint256.h.

◆ 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 214 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

Definition at line 117 of file arith_uint256.cpp.

◆ end() [1/2]

template<unsigned int BITS>
unsigned char* base_uint< BITS >::end ( )
inline

Definition at line 245 of file arith_uint256.h.

Here is the caller graph for this function:

◆ end() [2/2]

template<unsigned int BITS>
const unsigned char* base_uint< BITS >::end ( ) const
inline

Definition at line 255 of file arith_uint256.h.

◆ EqualTo()

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

Definition at line 129 of file arith_uint256.cpp.

◆ Get32()

template<unsigned int BITS>
uint32_t base_uint< BITS >::Get32 ( int  n = 0) const
inline

Definition at line 270 of file arith_uint256.h.

◆ Get64()

template<unsigned int BITS>
uint64_t base_uint< BITS >::Get64 ( int  n = 0) const
inline

Definition at line 265 of file arith_uint256.h.

◆ GetCheapHash()

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

Definition at line 304 of file arith_uint256.h.

Here is the caller graph for this function:

◆ getdouble()

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

Definition at line 143 of file arith_uint256.cpp.

Here is the caller graph for this function:

◆ GetHex()

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

Definition at line 155 of file arith_uint256.cpp.

Here is the caller graph for this function:

◆ GetLow64()

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

Definition at line 280 of file arith_uint256.h.

Here is the caller graph for this function:

◆ GetSerializeSize()

template<unsigned int BITS>
unsigned int base_uint< BITS >::GetSerializeSize ( int  nType,
int  nVersion 
) const
inline

Definition at line 286 of file arith_uint256.h.

◆ IsNull()

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

Definition at line 312 of file arith_uint256.h.

Here is the caller graph for this function:

◆ operator!()

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

Definition at line 66 of file arith_uint256.h.

◆ operator&=()

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

Definition at line 109 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 75 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 63 of file arith_uint256.cpp.

◆ operator++() [1/2]

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

Definition at line 178 of file arith_uint256.h.

◆ operator++() [2/2]

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

Definition at line 187 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 158 of file arith_uint256.h.

◆ operator-()

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

Definition at line 82 of file arith_uint256.h.

◆ operator--() [1/2]

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

Definition at line 195 of file arith_uint256.h.

◆ operator--() [2/2]

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

Definition at line 204 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 152 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 166 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 91 of file arith_uint256.cpp.

◆ operator<<=()

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

Definition at line 29 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 48 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 93 of file arith_uint256.h.

◆ operator>>=()

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

Definition at line 46 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 102 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 123 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 116 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 130 of file arith_uint256.h.

◆ operator~()

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

Definition at line 74 of file arith_uint256.h.

◆ Serialize()

template<unsigned int BITS>
template<typename Stream >
void base_uint< BITS >::Serialize ( Stream &  s,
int  nType,
int  nVersion 
) const
inline

Definition at line 292 of file arith_uint256.h.

◆ SetHex() [1/2]

template<unsigned int BITS>
void base_uint< BITS >::SetHex ( const char *  psz)

Definition at line 164 of file arith_uint256.cpp.

Here is the caller graph for this function:

◆ SetHex() [2/2]

template<unsigned int BITS>
void base_uint< BITS >::SetHex ( const std::string &  str)

Definition at line 193 of file arith_uint256.cpp.

◆ SetNull()

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

Definition at line 308 of file arith_uint256.h.

Here is the caller graph for this function:

◆ size()

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

Definition at line 260 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 199 of file arith_uint256.cpp.

◆ ToStringReverseEndian()

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

Definition at line 205 of file arith_uint256.cpp.

◆ Unserialize()

template<unsigned int BITS>
template<typename Stream >
void base_uint< BITS >::Unserialize ( Stream &  s,
int  nType,
int  nVersion 
)
inline

Definition at line 298 of file arith_uint256.h.

Friends And Related Function Documentation

◆ arith_uint160

template<unsigned int BITS>
friend class arith_uint160
friend

Definition at line 324 of file arith_uint256.h.

◆ arith_uint256

template<unsigned int BITS>
friend class arith_uint256
friend

Definition at line 325 of file arith_uint256.h.

◆ arith_uint512

template<unsigned int BITS>
friend class arith_uint512
friend

Definition at line 326 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 226 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 232 of file arith_uint256.h.

◆ operator&

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

Definition at line 220 of file arith_uint256.h.

◆ operator* [1/2]

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

Definition at line 217 of file arith_uint256.h.

◆ operator* [2/2]

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

Definition at line 224 of file arith_uint256.h.

◆ operator+

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

Definition at line 215 of file arith_uint256.h.

◆ operator-

template<unsigned int BITS>
const friend base_uint 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>
const friend base_uint 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>
bool operator< ( const base_uint< BITS > &  a,
const base_uint< BITS > &  b 
)
friend

Definition at line 228 of file arith_uint256.h.

◆ operator<<

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

Definition at line 223 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 230 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 225 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 231 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 227 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 229 of file arith_uint256.h.

◆ operator>>

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

Definition at line 222 of file arith_uint256.h.

◆ operator^

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

Definition at line 221 of file arith_uint256.h.

◆ operator|

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

Definition at line 219 of file arith_uint256.h.

◆ uint160

template<unsigned int BITS>
friend class uint160
friend

Definition at line 320 of file arith_uint256.h.

◆ uint256

template<unsigned int BITS>
friend class uint256
friend

Definition at line 321 of file arith_uint256.h.

◆ uint512

template<unsigned int BITS>
friend class uint512
friend

Definition at line 322 of file arith_uint256.h.

Member Data Documentation

◆ pn

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

Definition at line 34 of file arith_uint256.h.


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