Browse Source

fix bitmap-organized raw block initialization for occupied cells

Ioannis Koutras 12 years ago
parent
commit
bbdbaa4d64
1 changed files with 3 additions and 6 deletions
  1. 3 6
      src/raw_block.c

+ 3 - 6
src/raw_block.c

@@ -107,13 +107,10 @@ raw_block_header_t *create_raw_block(size_t raw_block_size, rb_type type) {
                  * element is used, the cells that cannot be used by the
                  * application, have to be set as already used.
                  */
-                if(i == 0 && remaining_cells != 0) {
+                if(i == bitmap_rb->elements - 1 && remaining_cells != 0) {
                     *bitmap_p = (BMAP_EL_TYPE) 1;
-                    for(size_t ones = remaining_cells - 1;
-                            ones > 0; --ones) {
-                        *bitmap_p <<= 1;
-                        (*bitmap_p)++;
-                    }
+                    *bitmap_p <<= remaining_cells;
+                    *bitmap_p -= 1;
                 } else {
                     *bitmap_p = BMAP_EL_INIT_VAL;
                 }