Browse Source

bitmap: show the bitmap vector in data layout ordering

Ioannis Koutras 12 years ago
parent
commit
8a013fea7d
1 changed files with 5 additions and 2 deletions
  1. 5 2
      src/bitmap/debug.c

+ 5 - 2
src/bitmap/debug.c

@@ -66,14 +66,17 @@ void print_bitmap_vector(bitmap_rb_t *raw_block) {
     el_out = &output[0];
 
     for(size_t i = 0; i < raw_block->elements; i++) {
-        for(z = ((BMAP_EL_TYPE) 1 << (BMAP_EL_SIZE_BITS - 1)); z > 0; z >>=1) {
+        for(z = 1; z <= ((BMAP_EL_TYPE) 1 << (BMAP_EL_SIZE_BITS - 1)); z <<= 1) {
             strcat(el_out, ((*bmap_p & z) == z) ? "0" : "1");
+            if(z == ((BMAP_EL_TYPE) 1 << (BMAP_EL_SIZE_BITS - 1))) {
+                break;
+            }
         }
         el_out += BMAP_EL_SIZE_BITS;
         bmap_p++;
     }
 
-    TRACE_3("Bitmap vector: %s\n", output);
+    TRACE_3("Cells in data layout: %s\n", output);
     TRACE_3("dmmlib - mem - bm - %zu\n", get_used_cells(raw_block));
 
     return;