Re: Remove fls(), use pg_bitutils.h facilities instead? - Mailing list pgsql-hackers

From David Rowley
Subject Re: Remove fls(), use pg_bitutils.h facilities instead?
Date
Msg-id CAApHDvrWZTD+ONUO8smvXebFTvQd-fqRuh6wpWuXL-jDsMSVJw@mail.gmail.com
Whole thread Raw
In response to Remove fls(), use pg_bitutils.h facilities instead?  (Thomas Munro <thomas.munro@gmail.com>)
List pgsql-hackers
On Wed, 20 Jul 2022 at 16:21, Thomas Munro <thomas.munro@gmail.com> wrote:
> Back in commit 4f658dc8 we gained src/port/fls.c.  As anticipated by
> its commit message, we later finished up with something better in
> src/include/port/pg_bitutils.h.  fls() ("find last set") is an
> off-by-one cousin of pg_leftmost_one_pos32().

Seems like a good idea to me.

One thing I noticed was that pg_leftmost_one_pos32() expects a uint32
but the new function passes it an int. Is it worth mentioning that's
ok in a comment somewhere or maybe adding an explicit cast?

David



pgsql-hackers by date:

Previous
From: Bharath Rupireddy
Date:
Subject: Re: Use "WAL segment" instead of "log segment" consistently in user-facing messages
Next
From: Thomas Munro
Date:
Subject: Re: Windows now has fdatasync()