mirror of
https://gitlab.isc.org/isc-projects/bind9
synced 2025-08-30 14:07:59 +00:00
Fix ISC_LEADING_ZEROS and ISC_TRAILING_ZEROS macros
This commit is contained in:
@@ -49,22 +49,22 @@
|
|||||||
#define ISC_LEADING_ZEROS(x) __builtin_clzg(x, (int)(sizeof(x) * 8))
|
#define ISC_LEADING_ZEROS(x) __builtin_clzg(x, (int)(sizeof(x) * 8))
|
||||||
#else /* HAVE_BUILTIN_CLZG */
|
#else /* HAVE_BUILTIN_CLZG */
|
||||||
#define ISC_LEADING_ZEROS(x) \
|
#define ISC_LEADING_ZEROS(x) \
|
||||||
((x) == 0) ? (sizeof(x) * 8) \
|
(((x) == 0) ? (sizeof(x) * 8) \
|
||||||
: _Generic((x), \
|
: _Generic((x), \
|
||||||
unsigned int: __builtin_clz, \
|
unsigned int: __builtin_clz, \
|
||||||
unsigned long: __builtin_clzl, \
|
unsigned long: __builtin_clzl, \
|
||||||
unsigned long long: __builtin_clzll)(x)
|
unsigned long long: __builtin_clzll)(x))
|
||||||
#endif /* HAVE_BUILTIN_CLZG */
|
#endif /* HAVE_BUILTIN_CLZG */
|
||||||
|
|
||||||
#ifdef HAVE_BUILTIN_CTZG
|
#ifdef HAVE_BUILTIN_CTZG
|
||||||
#define ISC_TRAILING_ZEROS(x) __builtin_ctzg(x, (int)sizeof(x) * 8)
|
#define ISC_TRAILING_ZEROS(x) __builtin_ctzg(x, (int)sizeof(x) * 8)
|
||||||
#else /* HAVE_BUILTIN_CTZG */
|
#else /* HAVE_BUILTIN_CTZG */
|
||||||
#define ISC_TRAILING_ZEROS(x) \
|
#define ISC_TRAILING_ZEROS(x) \
|
||||||
((x) == 0) ? (sizeof(x) * 8) \
|
(((x) == 0) ? (sizeof(x) * 8) \
|
||||||
: _Generic((x), \
|
: _Generic((x), \
|
||||||
unsigned int: __builtin_ctz, \
|
unsigned int: __builtin_ctz, \
|
||||||
unsigned long: __builtin_ctzl, \
|
unsigned long: __builtin_ctzl, \
|
||||||
unsigned long long: __builtin_ctzll)(x)
|
unsigned long long: __builtin_ctzll)(x))
|
||||||
#endif /* HAVE_BUILTIN_CTZG */
|
#endif /* HAVE_BUILTIN_CTZG */
|
||||||
|
|
||||||
#define ISC_LEADING_ONES(x) ISC_LEADING_ZEROS(~(x))
|
#define ISC_LEADING_ONES(x) ISC_LEADING_ZEROS(~(x))
|
||||||
|
Reference in New Issue
Block a user