26 #ifndef SAGA2_TILELOAD_H 27 #define SAGA2_TILELOAD_H 31 const int kMaxBanks = 64;
43 uint32 _b[kMaxBanks / 32];
54 return BankBits(c._b[0] + d._b[0], c._b[1] + d._b[1]);
58 return BankBits(c._b[0] - d._b[0], c._b[1] - d._b[1]);
61 void operator>>=(
int a) {
62 bool c = (bool)(_b[0] & 1);
65 _b[1] |= ((1 << 31) & (uint32)c);
67 void operator<<=(
int a) {
68 bool c = (bool)(_b[1] & (1 << 31));
70 _b[0] |= (1 & (uint32)c);
75 return BankBits(c._b[0] & d._b[0], c._b[1] & d._b[1]);
79 return BankBits(c._b[0] | d._b[0], c._b[1] | d._b[1]);
83 return BankBits(c._b[0] |= d._b[0], c._b[1] |= d._b[1]);
87 return (c._b[0] != d._b[0] && c._b[1] != d._b[1]);
91 return BankBits(c._b[0] ^ d._b[0], c._b[1] ^ d._b[1]);
94 bool isSet(uint16 i) {
95 return (
bool)(_b[i >> 5] & ((uint32) 1 << (i & 31)));
98 void SetBit(int16 i) {
99 _b[i / 32] |= ((uint32) 1 << (i % 32)) ;
101 void NotBit(int16 i) {
102 _b[i / 32] &= ~((uint32) 1 << (i % 32));
104 void Reset(uint32 c, uint32 d) {
109 return (_b[0] || _b[1]);
124 bool operator[](uint16 i) {
125 if (i < _size)
return (
bool)(_b[i / 32] & (1 << (i % 32)));
128 void resize(uint16 newSize);
135 klWords = ((size + 31) / 32)
138 int16 WORDNUM(
int n) {
141 int16 BITNUM(
int n) {
144 int16 BITMASK(
int n) {
145 return (1 << (n & 31));
151 memset(&_b, 0,
sizeof _b);
160 uint32 getChunk(uint16 i) {
164 bool operator[](uint32 ind) {
165 return (ind < size && (_b[WORDNUM(ind)] & BITMASK(ind)));
168 void Bit(uint32 ind,
bool val) {
170 if (val) _b[WORDNUM(ind)] |= BITMASK(ind);
171 else _b[WORDNUM(ind)] &= ~BITMASK(ind);
184 for (uint16 i = 0; i < klWords; i++)
185 t._b[i] = c._b[i] & d._b[i];
192 for (uint16 i = 0; i < klWords; i++)
193 t._b[i] = c._b[i] | d._b[i];
198 for (uint16 i = 0; i < klWords; i++)
204 for (uint16 i = 0; i < klWords; i++)
205 if (c._b[i] != d._b[i])
return true;
212 for (uint16 i = 0; i < klWords; i++)
213 t._b[i] = c._b[i] ^ d._b[i];
Definition: tileload.h:132
Definition: tileload.h:116
Definition: tileload.h:41