Bladeren bron

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

master
kevin.larke 4 jaren geleden
bovenliggende
commit
e9afa60e75
1 gewijzigde bestanden met toevoegingen van 6 en 0 verwijderingen
  1. 6
    0
      cmGlobal.h

+ 6
- 0
cmGlobal.h Bestand weergeven

@@ -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.

Laden…
Annuleren
Opslaan