Public Member Functions

CDynInt< T, sz > Class Template Reference


Detailed Description

template<class T, int sz>
class shogun::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 36 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

CDynInt (  ) 

default constructor

creates a DynInt that is all zero.

Definition at line 43 of file DynInt.h.

CDynInt ( uint8_t  x  ) 

constructor (set least significant ``word'')

The least significant word is set, the rest filled with zeros.

Parameters:
x least significant word

Definition at line 55 of file DynInt.h.

CDynInt ( uint16_t  x  ) 

constructor (set least significant ``word'')

The least significant word is set, the rest filled with zeros.

Parameters:
x least significant word

Definition at line 68 of file DynInt.h.

CDynInt ( uint32_t  x  ) 

constructor (set least significant ``word'')

The least significant word is set, the rest filled with zeros.

Parameters:
x least significant word

Definition at line 81 of file DynInt.h.

CDynInt ( int32_t  x  ) 

constructor (set least significant ``word'')

The least significant word is set, the rest filled with zeros.

Parameters:
x least significant word

Definition at line 94 of file DynInt.h.

CDynInt ( int64_t  x  ) 

constructor (set least significant ``word'')

The least significant word is set, the rest filled with zeros.

Parameters:
x least significant word

Definition at line 107 of file DynInt.h.

CDynInt ( uint64_t  x  ) 

constructor (set least significant ``word'')

The least significant word is set, the rest filled with zeros.

Parameters:
x least significant word

Definition at line 120 of file DynInt.h.

CDynInt ( const T  x[sz]  ) 

constructor (set whole array)

Initialize the DynInt based on an array, which is passed as an argument.

Parameters:
x array of size sz

Definition at line 133 of file DynInt.h.

CDynInt ( const CDynInt< T, sz > &  x  ) 

copy constructor

Definition at line 140 of file DynInt.h.

~CDynInt (  ) 

destructor

Definition at line 147 of file DynInt.h.


Member Function Documentation

operator T (  ) 

cast to least significant word *dangerous*

Definition at line 511 of file DynInt.h.

bool operator!= ( const CDynInt< T, sz > &  x  )  const

overload ! operator; test if current object is not equal to x

Parameters:
x x

Definition at line 426 of file DynInt.h.

const CDynInt<T,sz> operator& ( const CDynInt< T, sz > &  x  )  const

overload & operator and return x & y

Parameters:
x x

Definition at line 179 of file DynInt.h.

CDynInt<T,sz>& operator&= ( const CDynInt< T, sz > &  x  ) 

overload &= operator

perform bitwise and with current DynInt and x

Parameters:
x x

Definition at line 456 of file DynInt.h.

const CDynInt<T,sz> operator* ( const CDynInt< T, sz > &  x  )  const

overload * operator and return x * y

Parameters:
x x

Definition at line 302 of file DynInt.h.

CDynInt<T,sz>& operator*= ( const CDynInt< T, sz > &  x  ) 

overload *= operator; multiple x to with current DynInt

Parameters:
x x

Definition at line 329 of file DynInt.h.

const CDynInt<T,sz> operator+ ( const CDynInt< T, sz > &  x  )  const

overload + operator and return x + y

Parameters:
x x

Definition at line 263 of file DynInt.h.

CDynInt<T,sz>& operator++ (  ) 

increment DynInt by one

Definition at line 529 of file DynInt.h.

CDynInt<T,sz>& operator+= ( const CDynInt< T, sz > &  x  ) 

overload += operator; add x to current DynInt

Parameters:
x x

Definition at line 311 of file DynInt.h.

const CDynInt<T,sz> operator- ( const CDynInt< T, sz > &  x  )  const

overload - operator and return x - y

Parameters:
x x

Definition at line 284 of file DynInt.h.

CDynInt<T,sz>& operator-- (  ) 

decrement DynInt by one

Definition at line 514 of file DynInt.h.

CDynInt<T,sz>& operator-= ( const CDynInt< T, sz > &  x  ) 

overload -= operator; substract x from current DynInt

Parameters:
x x

Definition at line 320 of file DynInt.h.

const CDynInt<T,sz> operator/ ( const CDynInt< T, sz > &  x  )  const

overload / operator and return x / y

Parameters:
x x

Definition at line 293 of file DynInt.h.

CDynInt<T,sz>& operator/= ( const CDynInt< T, sz > &  x  ) 

overload /= operator; divide current object by x

Parameters:
x x

Definition at line 338 of file DynInt.h.

bool operator< ( const CDynInt< T, sz > &  x  )  const

overload < operator; test if current object is smaller than x

Parameters:
x x

Definition at line 410 of file DynInt.h.

CDynInt<T,sz> operator<< ( int  shift  ) 

overload << operator

perform bit shift to the left

Parameters:
shift shift by this amount

Definition at line 195 of file DynInt.h.

CDynInt<T,sz>& operator<<= ( int  shift  ) 

overload <<= operator

perform bit shift to the left

Parameters:
shift shift by this amount

Definition at line 484 of file DynInt.h.

bool operator<= ( const CDynInt< T, sz > &  x  )  const

overload <= operator; test if current object lower equal x

Parameters:
x x

Definition at line 378 of file DynInt.h.

CDynInt<T,sz>& operator= ( const CDynInt< T, sz > &  x  ) 

overload = operator

Parameters:
x assign elements from x

Definition at line 154 of file DynInt.h.

bool operator== ( const CDynInt< T, sz > &  x  )  const

overload == operator; test if current object equals x

Parameters:
x x

Definition at line 347 of file DynInt.h.

bool operator> ( const CDynInt< T, sz > &  x  )  const

overload > operator; test if current object is bigger than x

Parameters:
x x

Definition at line 394 of file DynInt.h.

bool operator>= ( const CDynInt< T, sz > &  x  )  const

overload >= operator; test if current object greater equal x

Parameters:
x x

Definition at line 362 of file DynInt.h.

CDynInt<T,sz> operator>> ( int  shift  ) 

overload >> operator

perform bit shift to the right

Parameters:
shift shift by this amount

Definition at line 223 of file DynInt.h.

CDynInt<T,sz>& operator>>= ( int  shift  ) 

overload >>= operator

perform bit shift to the right

Parameters:
shift shift by this amount

Definition at line 496 of file DynInt.h.

const CDynInt<T,sz> operator^ ( const CDynInt< T, sz > &  x  )  const

overload ^ operator and return x ^ y

Parameters:
x x

Definition at line 249 of file DynInt.h.

CDynInt<T,sz>& operator^= ( const CDynInt< T, sz > &  x  ) 

overload ^= operator

perform bitwise xor with current DynInt and x

Parameters:
x x

Definition at line 470 of file DynInt.h.

const CDynInt<T,sz> operator| ( const CDynInt< T, sz > &  x  )  const

overload | operator and return x | y

Parameters:
x x

Definition at line 165 of file DynInt.h.

CDynInt<T,sz>& operator|= ( const CDynInt< T, sz > &  x  ) 

overload |= operator

perform bitwise or with current DynInt and x

Parameters:
x x

Definition at line 442 of file DynInt.h.

CDynInt<T,sz>& operator~ (  ) 

negate DynInt

Definition at line 503 of file DynInt.h.

void print_bits (  )  const

print the current long integer in bits (without carriage return

Definition at line 551 of file DynInt.h.

void print_hex (  )  const

print the current long integer in hex (without carriage return

Definition at line 544 of file DynInt.h.


The documentation for this class was generated from the following file:
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines

SHOGUN Machine Learning Toolbox - Documentation