BLI_bitmap: fix _BITMAP_NUM_BLOCKS to not over-count by one block

For bit counts that were exact multiple of block size, the macro was
computing one block too much.

Reviewed By: Campbell Barton, Bastien Montagne
Differential Revision: https://developer.blender.org/D15454
This commit is contained in:
Aras Pranckevicius 2022-07-15 10:21:27 +03:00
parent 8fd2b79ca1
commit 63ea0f7581
1 changed files with 1 additions and 1 deletions

View File

@ -27,7 +27,7 @@ typedef unsigned int BLI_bitmap;
/**
* Number of blocks needed to hold '_num' bits.
*/
#define _BITMAP_NUM_BLOCKS(_num) (((_num) >> _BITMAP_POWER) + 1)
#define _BITMAP_NUM_BLOCKS(_num) (((_num) + _BITMAP_MASK) >> _BITMAP_POWER)
/**
* Size (in bytes) used to hold '_num' bits.