From 12b996e61b0b6805d1880ad94fe4e192fc6f41ae Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Sat, 13 Feb 2016 17:47:38 +1100 Subject: [PATCH] BLI_bitmap: add flip macro --- source/blender/blenlib/BLI_bitmap.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h index 60fc143a447..82704e95fdd 100644 --- a/source/blender/blenlib/BLI_bitmap.h +++ b/source/blender/blenlib/BLI_bitmap.h @@ -86,6 +86,12 @@ typedef unsigned int BLI_bitmap; ((_bitmap)[(_index) >> _BITMAP_POWER] &= \ ~(1u << ((_index) & _BITMAP_MASK)))) +/* flip the value of a single bit at '_index' */ +#define BLI_BITMAP_FLIP(_bitmap, _index) \ + (CHECK_TYPE_ANY(_bitmap, BLI_bitmap *, const BLI_bitmap *), \ + ((_bitmap)[(_index) >> _BITMAP_POWER] ^= \ + (1u << ((_index) & _BITMAP_MASK)))) + /* set or clear the value of a single bit at '_index' */ #define BLI_BITMAP_SET(_bitmap, _index, _set) \ { \