File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change 14
14
#include < algorithm>
15
15
#include < type_traits>
16
16
17
- #ifdef _MSC_VER
17
+ #if defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L
18
+ # include < bit>
19
+ #elif defined(_MSC_VER)
18
20
# include < intrin.h>
19
21
#endif
20
22
@@ -142,7 +144,11 @@ constexpr inline I Mask() { return ((I((I(-1)) << (std::numeric_limits<I>::digit
142
144
/* * Compute the smallest power of two that is larger than val. */
143
145
template <typename I>
144
146
static inline int CountBits (I val, int max) {
145
- #ifdef _MSC_VER
147
+ #if defined(__cpp_lib_int_pow2) && __cpp_lib_int_pow2 >= 202002L
148
+ // c++20 impl
149
+ (void )max;
150
+ return std::bit_width (val);
151
+ #elif defined(_MSC_VER)
146
152
(void )max;
147
153
unsigned long index;
148
154
unsigned char ret;
You can’t perform that action at this time.
0 commit comments