|
@@ -58,7 +58,6 @@ void * bitmap_malloc(raw_block_header_t *raw_block, size_t req_size) {
|
|
|
cells = req_size / rb_header->bytes_per_cell;
|
|
|
}
|
|
|
|
|
|
- // perform bitwise shift & and operations in the BMAP_EL_TYPE arrays
|
|
|
stop = prev_pow2(cells);
|
|
|
|
|
|
#ifdef HAVE_LOCKS
|
|
@@ -66,6 +65,8 @@ void * bitmap_malloc(raw_block_header_t *raw_block, size_t req_size) {
|
|
|
#endif /* HAVE_LOCKS */
|
|
|
|
|
|
copy_array(temp1, rb_header->bmap_array);
|
|
|
+
|
|
|
+ // perform bitwise shift & and operations in the BMAP_EL_TYPE arrays
|
|
|
for(i = 1; i < stop; i <<= 1) {
|
|
|
copy_array(temp2, temp1);
|
|
|
shift_array(temp2, i);
|
|
@@ -78,7 +79,6 @@ void * bitmap_malloc(raw_block_header_t *raw_block, size_t req_size) {
|
|
|
}
|
|
|
|
|
|
found = 0;
|
|
|
- ret = NULL;
|
|
|
|
|
|
for(i = 0; i < BMAP_INDEX_NUM; ++i) {
|
|
|
found = __builtin_ffsl(temp1[i]);
|
|
@@ -95,8 +95,9 @@ void * bitmap_malloc(raw_block_header_t *raw_block, size_t req_size) {
|
|
|
rb_header->bmap_array[i] &= mask1;
|
|
|
|
|
|
// Calculate the pointer to the chunk to be retrieved
|
|
|
- chunk_address = (chunk_header_t *)((char *)rb_header + (i *
|
|
|
- BMAP_EL_SIZE_BITS + found - 1) *
|
|
|
+ chunk_address = (chunk_header_t *)((char *)rb_header +
|
|
|
+ sizeof(bitmap_rb_t) +
|
|
|
+ (i * BMAP_EL_SIZE_BITS + found - 1) *
|
|
|
rb_header->bytes_per_cell);
|
|
|
chunk_address->num_of_cells = cells;
|
|
|
|