44 unsigned long int low;
55 BigInt(
unsigned long int a,
unsigned long int b ):
high( a ),
low( b ) {}
64 operator unsigned long int() {
72 operator unsigned int() {
74 return static_cast< unsigned int >(
low );
76 return static_cast< unsigned int >(
high );
80 operator unsigned short int() {
82 return static_cast< unsigned short int >(
low );
84 return static_cast< unsigned short int >(
high );
88 operator unsigned char() {
90 return static_cast< unsigned char >(
low );
92 return static_cast< unsigned char >(
high );
105 int bigint_compare(
const void *a,
const void *b ) {
109 if( left.
low == right.
low ) {
112 return (left.
low > right.
low) ? 1 : -1;
115 return (left.
high > right.
high) ? 1 : -1;
126 bool operator>(
const BigInt &left,
const BigInt &right ) {
127 return bigint_compare( &left, &right ) > 0;
137 bool operator<(
const BigInt &left,
const BigInt &right ) {
138 return bigint_compare( &left, &right ) < 0;
148 bool operator==(
const BigInt &left,
const BigInt &right ) {
159 bool operator!=(
const BigInt &left,
const BigInt &right ) {
170 bool operator>=(
const BigInt &left,
const BigInt &right ) {
171 return left == right || ( left > right );
181 bool operator<=(
const BigInt &left,
const BigInt &right ) {
182 return left == right || ( left < right );
void operator=(const BigInt &other)
Assignment operator.
Definition: BigInt.hpp:58
BigInt()
Default constructor (sets fields to zero).
Definition: BigInt.hpp:47
unsigned long int high
Most significant bits.
Definition: BigInt.hpp:41
A 128-bit integer, with overloaded comparison operators.
Definition: BigInt.hpp:38
BigInt(unsigned long int a, unsigned long int b)
Direct constructor.
Definition: BigInt.hpp:55
unsigned long int low
Least significant bits.
Definition: BigInt.hpp:44