Re: Remove fls(), use pg_bitutils.h facilities instead?

From: David Rowley <dgrowleyml(at)gmail(dot)com>
To: Thomas Munro <thomas(dot)munro(at)gmail(dot)com>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Remove fls(), use pg_bitutils.h facilities instead?
Date: 2022-07-20 04:43:03
Message-ID: CAApHDvrWZTD+ONUO8smvXebFTvQd-fqRuh6wpWuXL-jDsMSVJw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, 20 Jul 2022 at 16:21, Thomas Munro <thomas(dot)munro(at)gmail(dot)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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2022-07-20 04:48:58 Re: Windows now has fdatasync()
Previous Message Bharath Rupireddy 2022-07-20 04:32:22 Re: Use "WAL segment" instead of "log segment" consistently in user-facing messages