Skip to content

Commit 9e78492

Browse files
fix mingw bit calculation
1 parent 1172c34 commit 9e78492

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/ds/bits.h

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
#include <cstdint>
1414
#include <type_traits>
1515
#if defined(_WIN32) && defined(__GNUC__)
16-
# define USE_CLZLL
16+
# define USE_BIT_LL
1717
#endif
1818
#ifdef pause
1919
# undef pause
@@ -76,7 +76,7 @@ namespace snmalloc
7676

7777
return BITS - index - 1;
7878
# endif
79-
#elif defined(USE_CLZLL)
79+
#elif defined(USE_BIT_LL)
8080
return static_cast<size_t>(__builtin_clzll(x));
8181
#else
8282
return static_cast<size_t>(__builtin_clzl(x));
@@ -142,7 +142,9 @@ namespace snmalloc
142142

143143
inline size_t ctz(size_t x)
144144
{
145-
#if __has_builtin(__builtin_ctzl)
145+
#if defined(USE_BIT_LL)
146+
return static_cast<size_t>(__builtin_ctzll(x));
147+
#elif __has_builtin(__builtin_ctzl)
146148
return static_cast<size_t>(__builtin_ctzl(x));
147149
#elif defined(_MSC_VER)
148150
# ifdef SNMALLOC_VA_BITS_64

0 commit comments

Comments
 (0)