|
|
@ -204,16 +204,11 @@ TR_malloc(size_t size) |
|
|
size = 1 << (MIN_BITS - 1); |
|
|
size = 1 << (MIN_BITS - 1); |
|
|
idx = 0; |
|
|
idx = 0; |
|
|
} else { |
|
|
} else { |
|
|
size_t mask; |
|
|
|
|
|
|
|
|
|
|
|
idx = TR_bitwidth(size); |
|
|
|
|
|
mask = (1 << (idx + 1)) - 1; |
|
|
|
|
|
|
|
|
// size-1 to ensure that powers of two will not be |
|
|
|
|
|
// changed to the next power of two |
|
|
|
|
|
idx = TR_bitwidth(size-1) + 1; |
|
|
|
|
|
size = 1 << idx; |
|
|
idx -= (MIN_BITS - 1); |
|
|
idx -= (MIN_BITS - 1); |
|
|
|
|
|
|
|
|
if (size != (size & ~(mask >> 1))) { |
|
|
|
|
|
size = (size << 1) & ~mask; |
|
|
|
|
|
idx++; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|