SHOGUN  3.2.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
List of all members | 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 38 of file DynInt.h.

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 45 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
xleast significant word

Definition at line 57 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
xleast significant word

Definition at line 70 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
xleast significant word

Definition at line 83 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
xleast significant word

Definition at line 96 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
xleast significant word

Definition at line 109 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
xleast significant word

Definition at line 122 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
xarray of size sz

Definition at line 135 of file DynInt.h.

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

copy constructor

Definition at line 142 of file DynInt.h.

~CDynInt ( )

destructor

Definition at line 149 of file DynInt.h.

Member Function Documentation

operator T ( )

cast to least significant word dangerous

Definition at line 513 of file DynInt.h.

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

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

Parameters
xx

Definition at line 428 of file DynInt.h.

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

overload & operator and return x & y

Parameters
xx

Definition at line 181 of file DynInt.h.

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

overload &= operator

perform bitwise and with current DynInt and x

Parameters
xx

Definition at line 458 of file DynInt.h.

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

overload * operator and return x * y

Parameters
xx

Definition at line 304 of file DynInt.h.

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

overload *= operator; multiple x to with current DynInt

Parameters
xx

Definition at line 331 of file DynInt.h.

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

overload + operator and return x + y

Parameters
xx

Definition at line 265 of file DynInt.h.

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

increment DynInt by one

Definition at line 531 of file DynInt.h.

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

overload += operator; add x to current DynInt

Parameters
xx

Definition at line 313 of file DynInt.h.

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

overload - operator and return x - y

Parameters
xx

Definition at line 286 of file DynInt.h.

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

decrement DynInt by one

Definition at line 516 of file DynInt.h.

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

overload -= operator; substract x from current DynInt

Parameters
xx

Definition at line 322 of file DynInt.h.

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

overload / operator and return x / y

Parameters
xx

Definition at line 295 of file DynInt.h.

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

overload /= operator; divide current object by x

Parameters
xx

Definition at line 340 of file DynInt.h.

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

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

Parameters
xx

Definition at line 412 of file DynInt.h.

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

overload << operator

perform bit shift to the left

Parameters
shiftshift by this amount

Definition at line 197 of file DynInt.h.

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

overload <<= operator

perform bit shift to the left

Parameters
shiftshift by this amount

Definition at line 486 of file DynInt.h.

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

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

Parameters
xx

Definition at line 380 of file DynInt.h.

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

overload = operator

Parameters
xassign elements from x

Definition at line 156 of file DynInt.h.

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

overload == operator; test if current object equals x

Parameters
xx

Definition at line 349 of file DynInt.h.

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

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

Parameters
xx

Definition at line 396 of file DynInt.h.

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

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

Parameters
xx

Definition at line 364 of file DynInt.h.

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

overload >> operator

perform bit shift to the right

Parameters
shiftshift by this amount

Definition at line 225 of file DynInt.h.

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

overload >>= operator

perform bit shift to the right

Parameters
shiftshift by this amount

Definition at line 498 of file DynInt.h.

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

overload ^ operator and return x ^ y

Parameters
xx

Definition at line 251 of file DynInt.h.

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

overload ^= operator

perform bitwise xor with current DynInt and x

Parameters
xx

Definition at line 472 of file DynInt.h.

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

overload | operator and return x | y

Parameters
xx

Definition at line 167 of file DynInt.h.

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

overload |= operator

perform bitwise or with current DynInt and x

Parameters
xx

Definition at line 444 of file DynInt.h.

CDynInt<T,sz>& operator~ ( )

negate DynInt

Definition at line 505 of file DynInt.h.

void print_bits ( ) const

print the current long integer in bits (without carriage return

Definition at line 553 of file DynInt.h.

void print_hex ( ) const

print the current long integer in hex (without carriage return

Definition at line 546 of file DynInt.h.


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

SHOGUN Machine Learning Toolbox - Documentation