Re: move some bitmapset.c macros to bitmapset.h

2022-12-05 Thread Tom Lane
John Naylor writes: > Here's a quick go at that. I've not attempted to use it for what I need, > but it looks like it fits the bill. Passes a quick eyeball check, but of course we should have a concrete external use for the new pg_bitutils functions. regards, tom lane

Re: move some bitmapset.c macros to bitmapset.h

2022-12-05 Thread John Naylor
On Tue, Dec 6, 2022 at 12:57 PM Tom Lane wrote: > > Well, they've already escaped to tidbitmap.c as a copy. How do you feel > > about going that route? > > Not terribly pleased with that either, I must admit. Okay, I won't pursue that further. > If we do put RIGHTMOST_ONE functionality into pg_

Re: move some bitmapset.c macros to bitmapset.h

2022-12-05 Thread Tom Lane
David Rowley writes: > Maybe there's a path of lesser resistance... There's been a bit of > work in pg_bitutils.h to define some of the bit manipulation functions > for size_t types which wrap the 32 or 64-bit version of the function > accordingly. Couldn't we just define one of those for > pg_rig

Re: move some bitmapset.c macros to bitmapset.h

2022-12-05 Thread David Rowley
On Tue, 6 Dec 2022 at 17:57, Tom Lane wrote: > And RIGHTMOST_ONE is something that could be made public, but > I think it belongs in pg_bitutils.h, perhaps with a different > name. Maybe there's a path of lesser resistance... There's been a bit of work in pg_bitutils.h to define some of the bit m

Re: move some bitmapset.c macros to bitmapset.h

2022-12-05 Thread Tom Lane
John Naylor writes: > On Mon, Dec 5, 2022 at 9:33 PM Tom Lane wrote: >> IMV these are absolutely private to bitmapset.c. I reject the idea >> that they should be exposed publicly, under these names or any others. > Well, they've already escaped to tidbitmap.c as a copy. How do you feel > about

Re: move some bitmapset.c macros to bitmapset.h

2022-12-05 Thread John Naylor
On Mon, Dec 5, 2022 at 9:33 PM Tom Lane wrote: > > Alvaro Herrera writes: > > On 2022-Dec-05, John Naylor wrote: > >> -#define WORDNUM(x) ((x) / BITS_PER_BITMAPWORD) > >> -#define BITNUM(x) ((x) % BITS_PER_BITMAPWORD) > > > In this location, nobody can complain about the naming of these macros

Re: move some bitmapset.c macros to bitmapset.h

2022-12-05 Thread Tom Lane
Alvaro Herrera writes: > On 2022-Dec-05, John Naylor wrote: >> -#define WORDNUM(x) ((x) / BITS_PER_BITMAPWORD) >> -#define BITNUM(x) ((x) % BITS_PER_BITMAPWORD) > In this location, nobody can complain about the naming of these macros, > since they're just used to implement other bitmapset.c co

Re: move some bitmapset.c macros to bitmapset.h

2022-12-05 Thread Alvaro Herrera
On 2022-Dec-05, John Naylor wrote: > diff --git a/src/backend/nodes/bitmapset.c b/src/backend/nodes/bitmapset.c > index b7b274aeff..3204b49738 100644 > --- a/src/backend/nodes/bitmapset.c > +++ b/src/backend/nodes/bitmapset.c > @@ -26,33 +26,9 @@ > #include "port/pg_bitutils.h" > > > -#define

move some bitmapset.c macros to bitmapset.h

2022-12-05 Thread John Naylor
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 c