BoundingBox ReturnSubvolume(uint index) { std::bitset<D> bitindex(index); vec_t center = center_, halfSpace = half_space_ / 2; for (int i = 0;i < D; ++i) center(i) += halfSpace(i) * (bitindex[i] ? 1 : -1); return BoundingBox(center,halfSpace); }
int get_bit(bitarray *arr, int b) { return arr->words[bitindex(b)] >> bitoffset(b) & 0x1; }
void clear_bit(bitarray *arr, int b) { arr->words[bitindex(b)] &= ~(1 << (bitoffset(b))); }
void set_bit(bitarray * arr,int b) { arr->words[bitindex(b)] |= 1 << (bitoffset(b)); }
int get_bit(char *arr, int b) { return arr[bitindex(b)] >> bitoffset(b) & 0x1; }
void clear_bit(char *arr, int b) { arr[bitindex(b)] &= ~(1 << (bitoffset(b))); }
void set_bit(char * arr,int b) { arr[bitindex(b)] |= 1 << (bitoffset(b)); }