Re: remove open-coded popcount in acl.c

From: Álvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: remove open-coded popcount in acl.c
Date: 2025-03-12 16:23:25
Message-ID: 202503121623.i4enp6airsfl@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

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#5533
https://coverage.postgresql.org/src/backend/utils/adt/acl.c.gcov.html#5438

--
Álvaro Herrera Breisgau, Deutschland — https://www.EnterpriseDB.com/

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Álvaro Herrera 2025-03-12 16:27:15 Re: Document NULL
Previous Message Nazir Bilal Yavuz 2025-03-12 16:15:44 Re: Add pg_buffercache_evict_all() and pg_buffercache_mark_dirty[_all]() functions