From: Alessio Podda Date: Fri, 17 Apr 2026 09:42:53 +0000 (+0200) Subject: Fix stdc_count_zeros/stdc_count_ones polyfill mismatch X-Git-Tag: v9.21.23~4^2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=19a84c78d055683be6a61c753dc3aee0a9649995;p=thirdparty%2Fbind9.git Fix stdc_count_zeros/stdc_count_ones polyfill mismatch A previous commit introduced a latent bug where the wrong popcount definition was used when overriding the compilation mode to C23. This commit fixes it. --- diff --git a/lib/dns/qp_p.h b/lib/dns/qp_p.h index 21d7586ab0e..0378ce2ef8a 100644 --- a/lib/dns/qp_p.h +++ b/lib/dns/qp_p.h @@ -753,7 +753,7 @@ static inline dns_qpweight_t branch_count_bitmap_before(dns_qpnode_t *n, dns_qpshift_t bit) { uint64_t mask = (1ULL << bit) - 1 - TAG_MASK; uint64_t bitmap = branch_index(n) & mask; - return (dns_qpweight_t)stdc_count_zeros(bitmap); + return (dns_qpweight_t)stdc_count_ones(bitmap); } /* diff --git a/lib/isc/include/isc/bit.h b/lib/isc/include/isc/bit.h index a8b47e16bce..68f01bd5c94 100644 --- a/lib/isc/include/isc/bit.h +++ b/lib/isc/include/isc/bit.h @@ -26,9 +26,9 @@ #else /* __has_header() */ #ifdef HAVE_BUILTIN_POPCOUNTG -#define stdc_count_zeros(x) __builtin_popcountg(x) +#define stdc_count_ones(x) __builtin_popcountg(x) #else /* HAVE_BUILTIN_POPCOUNTG */ -#define stdc_count_zeros(x) \ +#define stdc_count_ones(x) \ _Generic((x), \ unsigned int: __builtin_popcount, \ unsigned long: __builtin_popcountl, \