CDynInt< T, sz > Class Template Reference
Detailed Description
template<class T, int sz>
class CDynInt< T, sz >
integer type of dynamic size
This object can be used to create huge integers. These integers can be used directly instead of the usual int32_t etc types since operators are properly overloaded.
An exampe use would be 512 wide unsigned ints consisting of four uint64's:
CDynInt<uint64_t, 4> int512;
This data type is mostly used as a (efficient) storage container for bit-mapped strings. Therefore, currently only comparison, assignment and bit operations are implemented.
- Todo:
- implement add,mul,div
Definition at line 34 of file DynInt.h.
List of all members.
Public Member Functions |
| CDynInt () |
| CDynInt (uint8_t x) |
| CDynInt (uint16_t x) |
| CDynInt (uint32_t x) |
| CDynInt (int32_t x) |
| CDynInt (int64_t x) |
| CDynInt (uint64_t x) |
| CDynInt (const T x[sz]) |
| CDynInt (const CDynInt< T, sz > &x) |
| ~CDynInt () |
CDynInt< T, sz > & | operator= (const CDynInt< T, sz > &x) |
const CDynInt< T, sz > | operator| (const CDynInt< T, sz > &x) const |
const CDynInt< T, sz > | operator& (const CDynInt< T, sz > &x) const |
CDynInt< T, sz > | operator<< (int shift) |
CDynInt< T, sz > | operator>> (int shift) |
const CDynInt< T, sz > | operator^ (const CDynInt< T, sz > &x) const |
const CDynInt< T, sz > | operator+ (const CDynInt< T, sz > &x) const |
const CDynInt< T, sz > | operator- (const CDynInt< T, sz > &x) const |
const CDynInt< T, sz > | operator/ (const CDynInt< T, sz > &x) const |
const CDynInt< T, sz > | operator* (const CDynInt< T, sz > &x) const |
CDynInt< T, sz > & | operator+= (const CDynInt< T, sz > &x) |
CDynInt< T, sz > & | operator-= (const CDynInt< T, sz > &x) |
CDynInt< T, sz > & | operator*= (const CDynInt< T, sz > &x) |
CDynInt< T, sz > & | operator/= (const CDynInt< T, sz > &x) |
bool | operator== (const CDynInt< T, sz > &x) const |
bool | operator>= (const CDynInt< T, sz > &x) const |
bool | operator<= (const CDynInt< T, sz > &x) const |
bool | operator> (const CDynInt< T, sz > &x) const |
bool | operator< (const CDynInt< T, sz > &x) const |
bool | operator!= (const CDynInt< T, sz > &x) const |
CDynInt< T, sz > & | operator|= (const CDynInt< T, sz > &x) |
CDynInt< T, sz > & | operator&= (const CDynInt< T, sz > &x) |
CDynInt< T, sz > & | operator^= (const CDynInt< T, sz > &x) |
CDynInt< T, sz > & | operator<<= (int shift) |
CDynInt< T, sz > & | operator>>= (int shift) |
CDynInt< T, sz > & | operator~ () |
| operator T () |
CDynInt< T, sz > & | operator-- () |
CDynInt< T, sz > & | operator++ () |
void | print_hex () const |
void | print_bits () const |
Constructor & Destructor Documentation
template<class T, int sz>
default constructor
creates a DynInt that is all zero.
Definition at line 41 of file DynInt.h.
template<class T, int sz>
constructor (set least significant ``word'')
The least significant word is set, the rest filled with zeros.
- Parameters:
-
Definition at line 53 of file DynInt.h.
template<class T, int sz>
constructor (set least significant ``word'')
The least significant word is set, the rest filled with zeros.
- Parameters:
-
Definition at line 66 of file DynInt.h.
template<class T, int sz>
constructor (set least significant ``word'')
The least significant word is set, the rest filled with zeros.
- Parameters:
-
Definition at line 79 of file DynInt.h.
template<class T, int sz>
constructor (set least significant ``word'')
The least significant word is set, the rest filled with zeros.
- Parameters:
-
Definition at line 92 of file DynInt.h.
template<class T, int sz>
constructor (set least significant ``word'')
The least significant word is set, the rest filled with zeros.
- Parameters:
-
Definition at line 105 of file DynInt.h.
template<class T, int sz>
constructor (set least significant ``word'')
The least significant word is set, the rest filled with zeros.
- Parameters:
-
Definition at line 118 of file DynInt.h.
template<class T, int sz>
constructor (set whole array)
Initialize the DynInt based on an array, which is passed as an argument.
- Parameters:
-
Definition at line 131 of file DynInt.h.
template<class T, int sz>
copy constructor
Definition at line 138 of file DynInt.h.
template<class T, int sz>
Member Function Documentation
template<class T, int sz>
cast to least significant word *dangerous*
Definition at line 509 of file DynInt.h.
template<class T, int sz>
bool CDynInt< T, sz >::operator!= |
( |
const CDynInt< T, sz > & |
x |
) |
const |
overload ! operator; test if current object is not equal to x
- Parameters:
-
Definition at line 424 of file DynInt.h.
template<class T, int sz>
overload & operator and return x & y
- Parameters:
-
Definition at line 177 of file DynInt.h.
template<class T, int sz>
overload &= operator
perform bitwise and with current DynInt and x
- Parameters:
-
Definition at line 454 of file DynInt.h.
template<class T, int sz>
overload * operator and return x * y
- Parameters:
-
Definition at line 300 of file DynInt.h.
template<class T, int sz>
overload *= operator; multiple x to with current DynInt
- Parameters:
-
Definition at line 327 of file DynInt.h.
template<class T, int sz>
overload + operator and return x + y
- Parameters:
-
Definition at line 261 of file DynInt.h.
template<class T, int sz>
increment DynInt by one
Definition at line 527 of file DynInt.h.
template<class T, int sz>
overload += operator; add x to current DynInt
- Parameters:
-
Definition at line 309 of file DynInt.h.
template<class T, int sz>
overload - operator and return x - y
- Parameters:
-
Definition at line 282 of file DynInt.h.
template<class T, int sz>
decrement DynInt by one
Definition at line 512 of file DynInt.h.
template<class T, int sz>
overload -= operator; substract x from current DynInt
- Parameters:
-
Definition at line 318 of file DynInt.h.
template<class T, int sz>
overload / operator and return x / y
- Parameters:
-
Definition at line 291 of file DynInt.h.
template<class T, int sz>
overload /= operator; divide current object by x
- Parameters:
-
Definition at line 336 of file DynInt.h.
template<class T, int sz>
overload < operator; test if current object is smaller than x
- Parameters:
-
Definition at line 408 of file DynInt.h.
template<class T, int sz>
overload << operator
perform bit shift to the left
- Parameters:
-
| shift | shift by this amount |
Definition at line 193 of file DynInt.h.
template<class T, int sz>
overload <<= operator
perform bit shift to the left
- Parameters:
-
| shift | shift by this amount |
Definition at line 482 of file DynInt.h.
template<class T, int sz>
bool CDynInt< T, sz >::operator<= |
( |
const CDynInt< T, sz > & |
x |
) |
const |
overload <= operator; test if current object lower equal x
- Parameters:
-
Definition at line 376 of file DynInt.h.
template<class T, int sz>
overload = operator
- Parameters:
-
Definition at line 152 of file DynInt.h.
template<class T, int sz>
bool CDynInt< T, sz >::operator== |
( |
const CDynInt< T, sz > & |
x |
) |
const |
overload == operator; test if current object equals x
- Parameters:
-
Definition at line 345 of file DynInt.h.
template<class T, int sz>
overload > operator; test if current object is bigger than x
- Parameters:
-
Definition at line 392 of file DynInt.h.
template<class T, int sz>
bool CDynInt< T, sz >::operator>= |
( |
const CDynInt< T, sz > & |
x |
) |
const |
overload >= operator; test if current object greater equal x
- Parameters:
-
Definition at line 360 of file DynInt.h.
template<class T, int sz>
overload >> operator
perform bit shift to the right
- Parameters:
-
| shift | shift by this amount |
Definition at line 221 of file DynInt.h.
template<class T, int sz>
overload >>= operator
perform bit shift to the right
- Parameters:
-
| shift | shift by this amount |
Definition at line 494 of file DynInt.h.
template<class T, int sz>
overload ^ operator and return x ^ y
- Parameters:
-
Definition at line 247 of file DynInt.h.
template<class T, int sz>
overload ^= operator
perform bitwise xor with current DynInt and x
- Parameters:
-
Definition at line 468 of file DynInt.h.
template<class T, int sz>
overload | operator and return x | y
- Parameters:
-
Definition at line 163 of file DynInt.h.
template<class T, int sz>
overload |= operator
perform bitwise or with current DynInt and x
- Parameters:
-
Definition at line 440 of file DynInt.h.
template<class T, int sz>
template<class T, int sz>
void CDynInt< T, sz >::print_bits |
( |
|
) |
const |
print the current long integer in bits (without carriage return
Definition at line 549 of file DynInt.h.
template<class T, int sz>
void CDynInt< T, sz >::print_hex |
( |
|
) |
const |
print the current long integer in hex (without carriage return
Definition at line 542 of file DynInt.h.
The documentation for this class was generated from the following file: