1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-18 17:42:25 +03:00

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
This commit is contained in:
Teodor Sigaev
2018-04-23 17:59:17 +03:00
parent 9975c128a1
commit a5ab8928d7
3 changed files with 49 additions and 1 deletions

View File

@ -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)