@@ -94,9 +94,7 @@ namespace kanzi {
9494 unsigned long res;
9595 _BitScanReverse (&res, x);
9696 return int (res);
97- #elif defined(__GNUG__)
98- return 31 ^ __builtin_clz (x);
99- #elif defined(__clang__)
97+ #elif defined(__GNUG__) || defined(__clang__)
10098 return 31 ^ __builtin_clz (x);
10199 #else
102100 int res = 0 ;
@@ -123,9 +121,7 @@ namespace kanzi {
123121 unsigned long res;
124122 _BitScanReverse64 (&res, x);
125123 return int (res);
126- #elif defined(__GNUG__)
127- return 63 ^ __builtin_clzll (x);
128- #elif defined(__clang__)
124+ #elif defined(__GNUG__) || defined(__clang__)
129125 return 63 ^ __builtin_clzll (x);
130126 #else
131127 int res = 0 ;
@@ -157,12 +153,10 @@ namespace kanzi {
157153 unsigned long res;
158154 _BitScanForward (&res, x);
159155 return int (res);
160- #elif defined(__GNUG__)
161- return __builtin_ctz (x);
162- #elif defined(__clang__)
156+ #elif defined(__GNUG__) || defined(__clang__)
163157 return __builtin_ctz (x);
164158 #else
165- return _log2 (( x & (~x + 1 )) - 1 );
159+ return _log2 (x & (~x + 1 ));
166160 #endif
167161 }
168162
@@ -174,12 +168,10 @@ namespace kanzi {
174168 unsigned long res;
175169 _BitScanForward64 (&res, x);
176170 return int (res);
177- #elif defined(__GNUG__)
178- return __builtin_ctzll (x);
179- #elif defined(__clang__)
171+ #elif defined(__GNUG__) || defined(__clang__)
180172 return __builtin_ctzll (x);
181173 #else
182- return _log2 (( x & (~x + 1 )) - 1 );
174+ return _log2 (x & (~x + 1 ));
183175 #endif
184176 }
185177}
0 commit comments