浏览代码

Small optimization in bibop_free()

Ioannis Koutras 12 年之前
父节点
当前提交
143639c31b
共有 1 个文件被更改,包括 2 次插入5 次删除
  1. 2 5
      src/bibop/bibop_free.c

+ 2 - 5
src/bibop/bibop_free.c

@@ -57,20 +57,17 @@ void bibop_free(raw_block_header_t *raw_block, void *ptr) {
 
     // If the sum of the starting position and the cells that are used is more
     // than the available bits of one bitmap array element, then we have to
-    // modify two elements.
+    // modify the next element as well.
     if(start_pos + cells_used <= BMAP_EL_SIZE_BITS) {
         mask1 = make_bit_mask(start_pos + 1, cells_used);
-
-        rb_header->bmap_array[bmap_index] |= mask1;
-
     } else {
         mask1 = make_bit_mask(start_pos + 1, BMAP_EL_SIZE_BITS - start_pos);
         mask2 = make_bit_mask((size_t) 1,
                 start_pos + cells_used - BMAP_EL_SIZE_BITS);
 
-        rb_header->bmap_array[bmap_index] |= mask1;
         rb_header->bmap_array[bmap_index + 1] |= mask2;
     }
+    rb_header->bmap_array[bmap_index] |= mask1;
 
 #ifdef HAVE_LOCKS
     pthread_mutex_unlock(&raw_block->mutex);