From: Álvaro Herrera <alvherre@alvh.no-ip.org>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: pgsql-hackers@postgresql.org
Subject: Re: remove open-coded popcount in acl.c
Date: Wed, 12 Mar 2025 17:23:25 +0100
Message-ID: <202503121623.i4enp6airsfl@alvherre.pgsql> (raw)
In-Reply-To: <Z9GtL7Nm6hsYyJnF@nathan>
On 2025-Mar-12, Nathan Bossart wrote:
> There's a count_one_bits() function in acl.c that can be replaced with a
> call to pg_popcount64(). This isn't performance-critical code, but IMHO we
> might as well use the centralized implementation.
Makes sense. Patch looks good to me.
> @@ -5532,7 +5514,7 @@ select_best_grantor(Oid roleId, AclMode privileges,
> */
> if (otherprivs != ACL_NO_RIGHTS)
> {
> - int nnewrights = count_one_bits(otherprivs);
> + int nnewrights = pg_popcount64(otherprivs);
Strange: this code is not covered by any tests.
https://coverage.postgresql.org/src/backend/utils/adt/acl.c.gcov.html#5533https://coverage.postgresql.org/src/backend/utils/adt/acl.c.gcov.html#5438
--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: alvherre@alvh.no-ip.org, nathandbossart@gmail.com
Subject: Re: remove open-coded popcount in acl.c
In-Reply-To: <202503121623.i4enp6airsfl@alvherre.pgsql>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox