/** Sets the idxth bit to b. The bit_vector is resized if necessary */
void set(size_t idx, bool b);
-
+ void set_le(size_t idx, bool b);
/** Adds bit b at the end of the bit_vector. The bit_vector is resized if
necessary */
void push_back(bool b);
/** Efficient unsafe get/get_field */
bool unsafe_get(size_t idx) const;
uint32_t unsafe_get_field(size_t idx, size_t len) const;
-
+ void debug(void) const;
private:
// true if get_vector_ptr() was called
*/
inline bool bit_vector::unsafe_get(size_t idx) const
{
- return (_vector[idx / W] >> (idx % W)) & true;
+ size_t i = idx / W;
+ size_t j = idx % W;
+ return (_vector[i] >> (W - 1 - j)) & true;
};
/** Unsafe version of get_field. Does not perform bound checking.
*/
inline uint32_t bit_vector::unsafe_get_field(size_t idx, size_t len) const
{
+ //TODO FIX TO REFLECT BIG ENDIAN ORDER.
switch (len){
case 8:
return ((uint8_t*)_vector)[idx];