Re: Use compiler intrinsics for bit ops in hash - Mailing list pgsql-hackers

From John Naylor
Subject Re: Use compiler intrinsics for bit ops in hash
Date
Msg-id CACPNZCvvhGc=RUn-5VdKA8OzYE4+2gQ4ZGp9+0AE2BZzEbmWxw@mail.gmail.com
Whole thread Raw
In response to Re: Use compiler intrinsics for bit ops in hash  (David Fetter <david@fetter.org>)
Responses Re: Use compiler intrinsics for bit ops in hash  (David Fetter <david@fetter.org>)
List pgsql-hackers
On Wed, Jan 15, 2020 at 6:09 AM David Fetter <david@fetter.org> wrote:
> [v2 patch]

Hi David,

I have a stylistic comment on this snippet:

- for (i = _hash_log2(metap->hashm_bsize); i > 0; --i)
- {
- if ((1 << i) <= metap->hashm_bsize)
- break;
- }
+ i =  pg_leftmost_one_pos32(metap->hashm_bsize);
  Assert(i > 0);
  metap->hashm_bmsize = 1 << i;
  metap->hashm_bmshift = i + BYTE_TO_BIT;

Naming the variable "i" made sense when it was a loop counter, but it
seems out of place now. Same with the Assert.

Also, this

+ * using BSR where available */

is not directly tied to anything in this function, or even in the
function it calls, and could get out of date easily.

-- 
John Naylor                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services



pgsql-hackers by date:

Previous
From: Michael Paquier
Date:
Subject: Re: Improve errors when setting incorrect bounds for SSL protocols
Next
From: Michael Paquier
Date:
Subject: Re: PATCH: standby crashed when replay block which truncated instandby but failed to truncate in master node