summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorTeodor Sigaev <teodor@sigaev.ru>2018-04-23 17:59:17 +0300
committerTeodor Sigaev <teodor@sigaev.ru>2018-04-23 17:59:17 +0300
commita5ab8928d7d9e2cf76ed0590efbd9795ea9e5b5e (patch)
tree5b08c17e1de26da5773d868c62662e72c16e2119 /src/backend
parent9975c128a1d1bd7e7366adf133b21540a2bc2450 (diff)
downloadpostgresql-a5ab8928d7d9e2cf76ed0590efbd9795ea9e5b5e.tar.gz
Make bms_prev_member work correctly with a 64 bit bitmapword
5c067521 erroneously had coded bms_prev_member assuming that a bitmapword would always hold 32 bits and started it's search on what it thought was the highest 8-bits of the word. This was not the case if bitmapwords were 64 bits. In passing add a test to exercise this function a little. Previously there was no coverage at all. David Rowly
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/nodes/bitmapset.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/backend/nodes/bitmapset.c b/src/backend/nodes/bitmapset.c
index 9341bf579e..81182f2518 100644
--- a/src/backend/nodes/bitmapset.c
+++ b/src/backend/nodes/bitmapset.c
@@ -1167,7 +1167,7 @@ bms_prev_member(const Bitmapset *a, int prevbit)
if (w != 0)
{
int result;
- int shift = 24;
+ int shift = BITS_PER_BITMAPWORD - 8;
result = wordnum * BITS_PER_BITMAPWORD;
while ((w >> shift) == 0)