We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 022b959 commit ac69518Copy full SHA for ac69518
src/int_utils.h
@@ -14,7 +14,9 @@
14
#include <algorithm>
15
#include <type_traits>
16
17
-#ifdef _MSC_VER
+#if defined(__cpp_lib_bitops)
18
+# include <bit>
19
+#elif defined(_MSC_VER)
20
# include <intrin.h>
21
#endif
22
@@ -130,7 +132,11 @@ constexpr inline I Mask() { return ((I((I(-1)) << (std::numeric_limits<I>::digit
130
132
/** Compute the smallest power of two that is larger than val. */
131
133
template<typename I>
134
static inline int CountBits(I val, int max) {
135
136
+ // c++20 impl
137
+ (void)max;
138
+ return std::bit_width(val);
139
140
(void)max;
141
unsigned long index;
142
unsigned char ret;
0 commit comments