summaryrefslogtreecommitdiffstats
path: root/src/bit.h
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2024-05-29 11:51:10 -0400
committerTavian Barnes <tavianator@tavianator.com>2024-05-29 11:53:18 -0400
commit377b427491bcbf00e97fe02f69ef253e5ea3a53b (patch)
tree80e2514977694451ae6fe629c875053691ab5d1e /src/bit.h
parent26ac7e36c0710284d18d95eb0e58e21178396ffd (diff)
downloadbfs-377b427491bcbf00e97fe02f69ef253e5ea3a53b.tar.xz
bit: Use <stdbit.h> if it exists, even without -std=c23
glibc added an implementation in 2.39.
Diffstat (limited to 'src/bit.h')
-rw-r--r--src/bit.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/bit.h b/src/bit.h
index 880ccd6..c494130 100644
--- a/src/bit.h
+++ b/src/bit.h
@@ -12,7 +12,7 @@
#include <limits.h>
#include <stdint.h>
-#if __STDC_VERSION__ >= C23
+#if BFS_HAS_STDBIT_H
# include <stdbit.h>
#endif
@@ -226,7 +226,7 @@ static inline uint8_t bswap_u8(uint8_t n) {
// C23 polyfill: bit utilities
-#if __STDC_VERSION__ >= C23
+#if __STDC_VERSION_STDBIT_H__ >= C23
# define count_ones stdc_count_ones
# define count_zeros stdc_count_zeros
# define leading_zeros stdc_leading_zeros
@@ -374,7 +374,7 @@ UINT_OVERLOADS(BIT_CEIL)
#define bit_floor(n) UINT_SELECT(n, bit_floor)(n)
#define bit_ceil(n) UINT_SELECT(n, bit_ceil)(n)
-#endif // __STDC_VERSION__ < C23
+#endif // __STDC_VERSION_STDBIT_H__ < C23
#define ROTATE_LEFT(type, suffix, width) \
static inline type rotate_left##suffix(type n, int c) { \