12 #ifdef MASSIVE_DATA_RLCSA
13 typedef unsigned long usint;
14 typedef signed long sint;
16 typedef unsigned int usint;
17 typedef signed int sint;
21 typedef unsigned char uchar;
22 typedef std::pair<usint, usint> pair_type;
25 inline usint length(usint n)
28 while(n > 0) { b++; n >>= 1; }
32 inline bool isEmpty(const pair_type& data)
34 return (data.first > data.second);
37 inline usint length(const pair_type& data)
39 return data.second + 1 - data.first;
43 const usint CHARS = ((usint)1 << CHAR_BIT);
44 const usint MEGABYTE = 1048576;
45 const usint MILLION = 1000000;
46 const usint WORD_BITS = CHAR_BIT * sizeof(usint);
47 const usint WORD_MAX = ~((usint)0);
49 const pair_type EMPTY_PAIR = pair_type(1, 0);
52 // Previous GET was broken when BITS == WORD_BITS
53 // Current version works for usints and less
54 //#define GET(FIELD, BITS) ((FIELD) & ((1 << (BITS)) - 1))
55 #define GET(FIELD, BITS) ((FIELD) & (WORD_MAX >> (WORD_BITS - (BITS))))
56 #define LOWER(FIELD, N) ((FIELD) >> (N))
57 #define HIGHER(FIELD, N) ((FIELD) << (N))
59 #define BITS_TO_BYTES(BITS) (((BITS) + CHAR_BIT - 1) / CHAR_BIT)
60 #define BYTES_TO_WORDS(BYTES) (((BYTES) + sizeof(usint) - 1) / sizeof(usint))
61 #define BITS_TO_WORDS(BITS) (((BITS) + WORD_BITS - 1) / WORD_BITS)