Browse Source

cmGlobal.h : Added cmXXXBits() in-place binary operations.

master
kevin.larke 4 years ago
parent
commit
e9afa60e75
1 changed files with 6 additions and 0 deletions
  1. 6
    0
      cmGlobal.h

+ 6
- 0
cmGlobal.h View File

@@ -91,6 +91,12 @@ extern "C" {
91 91
                                                                //<
92 92
                                                                //< If 'b' == 0 then return 'f' with the bits in 'm' cleared.
93 93
                                                                //< otherwise return 'f' with the bits in 'm' set.
94
+  
95
+// In-place assignment version of the above bit operations
96
+#define cmSetBits(f,m)   ((f) |= (m))                             // Set 'f' with the bits in 'm' set.
97
+#define cmClrBits(f,m)   ((f) &= (~(m)))                          // Set 'f' with the bits in 'm' cleared.
98
+#define cmTogBits(f,m)   ((f)^=(m))                               // Return 'f' with the bits in 'm' toggled.
99
+#define cmEnaBits(f,m,b) ((b) ? cmSetBits(f,m) : cmClrBits(f,m))  // Set or clear bits in 'f' based on bits in 'm' and the state of 'b'.
94 100
 
95 101
 
96 102
 #define cmMin(v0,v1) ((v0)<(v1) ? (v0) : (v1)) //< Return the minimum arg.

Loading…
Cancel
Save