41 #define MAX(a,b) ((a)<(b)?(b):(a)) 44 #define CUINT_DEFAULT_SIZE (4) // size in 32 bit words 52 unsigned int defaultData[CUINT_DEFAULT_SIZE];
65 allocatedSize = CUINT_DEFAULT_SIZE;
78 allocatedSize = CUINT_DEFAULT_SIZE;
94 allocatedSize = CUINT_DEFAULT_SIZE;
98 for( i = 0; i < size; i++ ) {
99 data[i] = aValue.data[i];
108 if( heap == NULL && data != defaultData ) {
131 for( i = 0; i < size; i++ ) {
132 data[i] = aValue.data[i];
139 if( aValue>>32 != 0 ) {
142 data[1] = aValue>>32;
223 void calibrate(
void )
226 for( i=size-1; i>0; i-- ) {
234 void grow(
int aSize )
238 if( aSize <= size ) {
242 if( allocatedSize < aSize ) {
244 if( data != defaultData ) {
245 unsigned int* newData;
247 memcpy( newData, data, size*4 );
252 memcpy( data, defaultData, size*4 );
255 unsigned int* newData;
256 newData = (
unsigned int*)heap->
Alloc( aSize*4 );
257 memcpy( newData, data, size*4 );
260 allocatedSize = aSize;
262 for( i=size; i < aSize; i++ ) {
void * shell_xmalloc(int s)
Definition: main.cc:369
unsigned long long UINT64
Short cut for unsigned 64 bit integer.
Definition: glue.h:55
CUInt operator%(const CUInt &) const
int operator>=(const CUInt &) const
CUInt(const CUInt &aValue)
Create a copy of unsigned integer object.
Definition: cuint.h:89
Infinite precision unsigned arithmetic class Storage within object will be used whenever possible...
Definition: cuint.h:50
int operator<=(const CUInt &) const
CUInt operator>>(const CUInt &) const
int operator!=(const CUInt &) const
void Truncate(int newSize)
Change size of unsigned integer.
Definition: cuint.h:157
virtual ~CUInt()
Destory object and free any storage.
Definition: cuint.h:106
CUInt operator/(const CUInt &) const
CUInt operator-(const CUInt &) const
void shell_xfree(void *p, int s)
Definition: main.cc:365
long INT32
Short cut for signed 32 bit integer.
Definition: glue.h:38
CUInt operator~(void) const
int operator==(const CUInt &) const
void * Alloc(INT32 size)
Allocate block of storage with given size.
Bulk object allocation object.
Definition: cobstack.h:46
const UINT64 operator=(const UINT64 aValue)
Definition: cuint.h:137
int operator>(const CUInt &) const
CUInt operator &(const CUInt &) const
CUInt(void)
Create a unsigned integer object.
Definition: cuint.h:62
CUInt operator+(const CUInt &) const
void SetHeap(CObstack *aHeap)
Set heap to be used for storage allocation.
Definition: cuint.h:119
const CUInt & operator=(const CUInt &aValue)
Definition: cuint.h:126
CUInt operator<<(const CUInt &) const
unsigned long UINT32
Short cut for unsigned 32 bit integer.
Definition: glue.h:47
int operator<(const CUInt &) const
UINT32 Size()
Calculate the number of non-zero significant bits.
CUInt operator^(const CUInt &) const
CUInt(unsigned int aValue)
Create a unsigned integer object initialize with value.
Definition: cuint.h:75
CUInt operator*(const CUInt &) const
CUInt operator|(const CUInt &) const