public inbox for [email protected]  
help / color / mirror / Atom feed
From: Nathan Bossart <[email protected]>
Subject: [PATCH v4 3/4] Remove bmw_popcount().
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



view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected]
  Subject: Re: [PATCH v4 3/4] Remove bmw_popcount().
  In-Reply-To: <no-message-id-77475@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox