[Bf-blender-cvs] [12b996e] master: BLI_bitmap: add flip macro

Campbell Barton noreply at git.blender.org
Sat Feb 13 09:07:59 CET 2016


Commit: 12b996e61b0b6805d1880ad94fe4e192fc6f41ae
Author: Campbell Barton
Date:   Sat Feb 13 17:47:38 2016 +1100
Branches: master
https://developer.blender.org/rB12b996e61b0b6805d1880ad94fe4e192fc6f41ae

BLI_bitmap: add flip macro

===================================================================

M	source/blender/blenlib/BLI_bitmap.h

===================================================================

diff --git a/source/blender/blenlib/BLI_bitmap.h b/source/blender/blenlib/BLI_bitmap.h
index 60fc143..82704e9 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) \
 	{ \




More information about the Bf-blender-cvs mailing list