1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
|
#ifndef PACKEDARRAY_DEF
#define PACKEDARRAY_DEF
#include "IncludeDefine.h"
class PackedArray {
private:
uint bitRecMask, wordCompLength;
bool arrayAllocated; //true if charArray was allocated
public:
uint wordLength, length, lengthByte;
uint operator [] (uint ii);
char* charArray;
PackedArray();
void defineBits (uint Nbits, uint lengthIn);
void writePacked(uint jj, uint x);
void allocateArray();
void deallocateArray();
void pointArray(char* pointerCharIn);
// PackedArray(uint N);
};
inline uint PackedArray::operator [] (uint ii) {
uint b=ii*wordLength;
uint B=b/8;
uint S=b%8;
uint a1 = *((uint*) (charArray+B));
a1 = ((a1>>S)<<wordCompLength)>>wordCompLength;
return a1;
};
#endif
|