Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAras Pranckevicius <aras@nesnausk.org>2022-07-15 10:21:27 +0300
committerAras Pranckevicius <aras@nesnausk.org>2022-07-15 10:21:27 +0300
commit63ea0f7581faeeb629b040b7a4dc661bc84c789c (patch)
tree22ec0e460d2c7e3d27adc8a7eebbbf0ce618e692
parent8fd2b79ca190946fe95d915d19abbe9ddac895e9 (diff)
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
-rw-r--r--source/blender/blenlib/BLI_bitmap.h2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h
index 26dc6c7ffc9..973cc5c3d1e 100644
--- a/source/blender/blenlib/BLI_bitmap.h
+++ b/source/blender/blenlib/BLI_bitmap.h
@@ -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.