move some bitmapset.c macros to bitmapset.h - Mailing list pgsql-hackers

From John Naylor
Subject move some bitmapset.c macros to bitmapset.h
Date
Msg-id CAFBsxsFW2JjTo58jtDB+3sZhxMx3t-3evew8=Acr+GGhC+kFaA@mail.gmail.com
Whole thread Raw
Responses Re: move some bitmapset.c macros to bitmapset.h
List pgsql-hackers
Over in [1], Masahiko and I found that using some bitmapset logic yields a useful speedup in one part of the proposed radix tree patch. In addition to what's in bitmapset.h now, we'd need WORDNUM, BITNUM, RIGHTMOST_ONE and bmw_rightmost_one_pos() from bitmapset.c. The file tidbitmap.c has its own copies of the first two, and we could adapt that strategy again. But instead of three files defining these, it seems like it's time to consider moving them somewhere more central.

Attached is a simple form of this concept, including moving HAS_MULTIPLE_ONES just for consistency. One possible objection is the possibility of namespace clash. Thoughts?

I also considered putting the macros and typedefs in pg_bitutils.h. One organizational advantage is that pg_bitutils.h already offers convenience function symbols where the parameter depends on SIZEOF_SIZE_T, so putting the BITS_PER_BITMAPWORD versions there makes sense. But that way is not a clear win, so I didn't go that far.

[1] https://www.postgresql.org/message-id/CAFBsxsHgP5LP9q%3DRq_3Q2S6Oyut67z%2BVpemux%2BKseSPXhJF7sg%40mail.gmail.com

--
Attachment

pgsql-hackers by date:

Previous
From: Pavel Borisov
Date:
Subject: Re: Allow placeholders in ALTER ROLE w/o superuser
Next
From: Alvaro Herrera
Date:
Subject: Re: move some bitmapset.c macros to bitmapset.h