mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-22 01:59:26 +00:00
fix: nil: Fix ISC_LEADING_ZEROS and ISC_TRAILING_ZEROS macros
Closes #5488 Merge branch '5488-fix-isc-leading-trailing-zeros-macros' into 'main' See merge request isc-projects/bind9!10875
This commit is contained in:
commit
b7eb292121
@ -49,22 +49,22 @@
|
||||
#define ISC_LEADING_ZEROS(x) __builtin_clzg(x, (int)(sizeof(x) * 8))
|
||||
#else /* HAVE_BUILTIN_CLZG */
|
||||
#define ISC_LEADING_ZEROS(x) \
|
||||
((x) == 0) ? (sizeof(x) * 8) \
|
||||
(((x) == 0) ? (sizeof(x) * 8) \
|
||||
: _Generic((x), \
|
||||
unsigned int: __builtin_clz, \
|
||||
unsigned long: __builtin_clzl, \
|
||||
unsigned long long: __builtin_clzll)(x)
|
||||
unsigned long long: __builtin_clzll)(x))
|
||||
#endif /* HAVE_BUILTIN_CLZG */
|
||||
|
||||
#ifdef HAVE_BUILTIN_CTZG
|
||||
#define ISC_TRAILING_ZEROS(x) __builtin_ctzg(x, (int)sizeof(x) * 8)
|
||||
#else /* HAVE_BUILTIN_CTZG */
|
||||
#define ISC_TRAILING_ZEROS(x) \
|
||||
((x) == 0) ? (sizeof(x) * 8) \
|
||||
(((x) == 0) ? (sizeof(x) * 8) \
|
||||
: _Generic((x), \
|
||||
unsigned int: __builtin_ctz, \
|
||||
unsigned long: __builtin_ctzl, \
|
||||
unsigned long long: __builtin_ctzll)(x)
|
||||
unsigned long long: __builtin_ctzll)(x))
|
||||
#endif /* HAVE_BUILTIN_CTZG */
|
||||
|
||||
#define ISC_LEADING_ONES(x) ISC_LEADING_ZEROS(~(x))
|
||||
|
Loading…
x
Reference in New Issue
Block a user