From 2b7ad083dcfa8200058804fd142591851637105a Mon Sep 17 00:00:00 2001 From: Andrew Kane Date: Wed, 10 Jun 2026 20:08:03 -0700 Subject: [PATCH] Always use inline pg_popcount64 for Postgres 19+ - #985 --- src/bitutils.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/bitutils.c b/src/bitutils.c index 8e24c99..a83776d 100644 --- a/src/bitutils.c +++ b/src/bitutils.c @@ -31,8 +31,10 @@ #define BIT_TARGET_CLONES #endif -/* Use built-ins when possible for inlining */ -#if defined(HAVE__BUILTIN_POPCOUNT) && (defined(HAVE_LONG_INT_64) || SIZEOF_LONG == 8) +/* Use built-ins when possible for Postgres < 19 for inlining */ +#if PG_VERSION_NUM >= 190000 +#define popcount64(x) pg_popcount64(x) +#elif defined(HAVE__BUILTIN_POPCOUNT) && (defined(HAVE_LONG_INT_64) || SIZEOF_LONG == 8) #define popcount64(x) __builtin_popcountl(x) #elif defined(HAVE__BUILTIN_POPCOUNT) && (defined(HAVE_LONG_LONG_INT_64) || SIZEOF_LONG_LONG == 8) #define popcount64(x) __builtin_popcountll(x)