Remove spurious printfs.
[SXSI/XMLTree.git] / bit-vector.hpp
index cd6382e..76ed870 100644 (file)
@@ -56,7 +56,7 @@ class bit_vector {
 
   /** 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);
@@ -94,7 +94,7 @@ class bit_vector {
   /** 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
@@ -117,7 +117,9 @@ private:
  */
 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.
@@ -125,6 +127,7 @@ inline bool bit_vector::unsafe_get(size_t idx) const
 */
 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];