Subject: [PATCH v4 3/4] Remove bmw_popcount().

From: Nathan Bossart <[email-masked]>
Date: Fri, 23 Jan 2026 17:07:32 -0600

---
 src/backend/nodes/bitmapset.c | 4 +++-
 src/include/nodes/bitmapset.h | 2 --
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/src/backend/nodes/bitmapset.c b/src/backend/nodes/bitmapset.c
index 23c91fdb6c9..c057058a974 100644
--- a/src/backend/nodes/bitmapset.c
+++ b/src/backend/nodes/bitmapset.c
@@ -542,6 +542,7 @@ bms_member_index(Bitmapset *a, int x)
 	int			wordnum;
 	int			result = 0;
 	bitmapword	mask;
+	bitmapword	last;
 
 	Assert(bms_is_valid_set(a));
 
@@ -563,7 +564,8 @@ bms_member_index(Bitmapset *a, int x)
 	 * itself, so we subtract 1.
 	 */
 	mask = ((bitmapword) 1 << bitnum) - 1;
-	result += bmw_popcount(a->words[wordnum] & mask);
+	last = a->words[wordnum] & mask;
+	result += pg_popcount((const char *) &last, sizeof(bitmapword));
 
 	return result;
 }
diff --git a/src/include/nodes/bitmapset.h b/src/include/nodes/bitmapset.h
index 067ec72e99b..20938cfd2a7 100644
--- a/src/include/nodes/bitmapset.h
+++ b/src/include/nodes/bitmapset.h
@@ -77,11 +77,9 @@ typedef enum
 #if BITS_PER_BITMAPWORD == 32
 #define bmw_leftmost_one_pos(w)		pg_leftmost_one_pos32(w)
 #define bmw_rightmost_one_pos(w)	pg_rightmost_one_pos32(w)
-#define bmw_popcount(w)				pg_popcount32(w)
 #elif BITS_PER_BITMAPWORD == 64
 #define bmw_leftmost_one_pos(w)		pg_leftmost_one_pos64(w)
 #define bmw_rightmost_one_pos(w)	pg_rightmost_one_pos64(w)
-#define bmw_popcount(w)				pg_popcount64(w)
 #else
 #error "invalid BITS_PER_BITMAPWORD"
 #endif
-- 
2.50.1 (Apple Git-155)

--u/0bDz5KPuHk2IF+
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment;
	filename=v4-0004-Remove-specialized-word-length-popcount-implement.patch