소스 검색

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

master
kevin.larke 4 년 전
부모
커밋
e9afa60e75
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  1. 6
    0
      cmGlobal.h

+ 6
- 0
cmGlobal.h 파일 보기

91
                                                                //<
91
                                                                //<
92
                                                                //< If 'b' == 0 then return 'f' with the bits in 'm' cleared.
92
                                                                //< If 'b' == 0 then return 'f' with the bits in 'm' cleared.
93
                                                                //< otherwise return 'f' with the bits in 'm' set.
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
 #define cmMin(v0,v1) ((v0)<(v1) ? (v0) : (v1)) //< Return the minimum arg.
102
 #define cmMin(v0,v1) ((v0)<(v1) ? (v0) : (v1)) //< Return the minimum arg.

Loading…
취소
저장