Confusing comment in tidbitmap.c - Mailing list pgsql-hackers

From David Rowley
Subject Confusing comment in tidbitmap.c
Date
Msg-id CAApHDvrYG5ooAMkxbiEs3fs_wkqk0ibfii=ghmtNJ9rTb_nVKg@mail.gmail.com
Whole thread Raw
Responses Re: Confusing comment in tidbitmap.c  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
The following comment above #define PAGES_PER_CHUNK in tibbitmap.c appears to be incorrect:

"But we
 * also want PAGES_PER_CHUNK to be a power of 2 to avoid expensive integer
 * remainder operations.  So, define it like this:"

I don't quite follow this as it does nothing of the kind. Check tbm_page_is_lossy() where we do: bitno = pageno % PAGES_PER_CHUNK;

Or am I missing something about the compiler optimizing that to: bitno = pageno & 255; ?

Regards

David Rowley

pgsql-hackers by date:

Previous
From: Amit Kapila
Date:
Subject: Re: pg_basebackup vs. Windows and tablespaces
Next
From: David Rowley
Date:
Subject: Re: speedup tidbitmap patch: cache page