Commit 0078bed 1 parent 1c77291 commit 0078bed Copy full SHA for 0078bed
File tree 1 file changed +11
-11
lines changed
1 file changed +11
-11
lines changed Original file line number Diff line number Diff line change @@ -129,17 +129,7 @@ constexpr inline I Mask() { return ((I((I(-1)) << (std::numeric_limits<I>::digit
129
129
/* * Compute the smallest power of two that is larger than val. */
130
130
template <typename I>
131
131
static inline int CountBits (I val, int max) {
132
- #ifdef HAVE_CLZ
133
- (void )max;
134
- if (val == 0 ) return 0 ;
135
- if (std::numeric_limits<unsigned >::digits >= std::numeric_limits<I>::digits) {
136
- return std::numeric_limits<unsigned >::digits - __builtin_clz (val);
137
- } else if (std::numeric_limits<unsigned long >::digits >= std::numeric_limits<I>::digits) {
138
- return std::numeric_limits<unsigned long >::digits - __builtin_clzl (val);
139
- } else {
140
- return std::numeric_limits<unsigned long long >::digits - __builtin_clzll (val);
141
- }
142
- #elif _MSC_VER
132
+ #ifdef _MSC_VER
143
133
(void )max;
144
134
unsigned long index ;
145
135
unsigned char ret;
@@ -150,6 +140,16 @@ static inline int CountBits(I val, int max) {
150
140
}
151
141
if (!ret) return 0 ;
152
142
return index + 1 ;
143
+ #elif HAVE_CLZ
144
+ (void )max;
145
+ if (val == 0 ) return 0 ;
146
+ if (std::numeric_limits<unsigned >::digits >= std::numeric_limits<I>::digits) {
147
+ return std::numeric_limits<unsigned >::digits - __builtin_clz (val);
148
+ } else if (std::numeric_limits<unsigned long >::digits >= std::numeric_limits<I>::digits) {
149
+ return std::numeric_limits<unsigned long >::digits - __builtin_clzl (val);
150
+ } else {
151
+ return std::numeric_limits<unsigned long long >::digits - __builtin_clzll (val);
152
+ }
153
153
#else
154
154
while (max && (val >> (max - 1 ) == 0 )) --max;
155
155
return max;
You can’t perform that action at this time.
0 commit comments