Skip to content

Commit 3e76a80

Browse files
committed
Move some bitmap logic out of bitmapset.c
Move the logic for selecting appropriate pg_bitutils.h functions based on word size to bitmapset.h for wider visibility. Reviewed (in a previous version) by Tom Lane Discussion: https://postgr.es/m/CAFBsxsFW2JjTo58jtDB%2B3sZhxMx3t-3evew8%3DAcr%2BGGhC%2BkFaA%40mail.gmail.com
1 parent 9f225e9 commit 3e76a80

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

src/backend/nodes/bitmapset.c

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -71,19 +71,6 @@
7171

7272
#define HAS_MULTIPLE_ONES(x) ((bitmapword) RIGHTMOST_ONE(x) != (x))
7373

74-
/* Select appropriate bit-twiddling functions for bitmap word size */
75-
#if BITS_PER_BITMAPWORD == 32
76-
#define bmw_leftmost_one_pos(w) pg_leftmost_one_pos32(w)
77-
#define bmw_rightmost_one_pos(w) pg_rightmost_one_pos32(w)
78-
#define bmw_popcount(w) pg_popcount32(w)
79-
#elif BITS_PER_BITMAPWORD == 64
80-
#define bmw_leftmost_one_pos(w) pg_leftmost_one_pos64(w)
81-
#define bmw_rightmost_one_pos(w) pg_rightmost_one_pos64(w)
82-
#define bmw_popcount(w) pg_popcount64(w)
83-
#else
84-
#error "invalid BITS_PER_BITMAPWORD"
85-
#endif
86-
8774
#ifdef USE_ASSERT_CHECKING
8875
/*
8976
* bms_is_valid_set - for cassert builds to check for valid sets

src/include/nodes/bitmapset.h

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ typedef enum
7373
BMS_MULTIPLE, /* >1 member */
7474
} BMS_Membership;
7575

76+
/* Select appropriate bit-twiddling functions for bitmap word size */
77+
#if BITS_PER_BITMAPWORD == 32
78+
#define bmw_leftmost_one_pos(w) pg_leftmost_one_pos32(w)
79+
#define bmw_rightmost_one_pos(w) pg_rightmost_one_pos32(w)
80+
#define bmw_popcount(w) pg_popcount32(w)
81+
#elif BITS_PER_BITMAPWORD == 64
82+
#define bmw_leftmost_one_pos(w) pg_leftmost_one_pos64(w)
83+
#define bmw_rightmost_one_pos(w) pg_rightmost_one_pos64(w)
84+
#define bmw_popcount(w) pg_popcount64(w)
85+
#else
86+
#error "invalid BITS_PER_BITMAPWORD"
87+
#endif
88+
7689

7790
/*
7891
* function prototypes in nodes/bitmapset.c

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy