Re: use __builtin_clz to compute most significant bit set

From: Magnus Hagander <magnus(at)hagander(dot)net>
To: Joseph Yu <kiddo831007(at)gmail(dot)com>
Cc: pgsql-hackers(at)postgresql(dot)org
Subject: Re: use __builtin_clz to compute most significant bit set
Date: 2023-02-25 20:47:16
Message-ID: CABUevEzPTbDE=YaVwFTrZJx9OCF-qSnHe1iqgfuH2JTVgELpOw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sat, Feb 25, 2023 at 9:32 PM Joseph Yu <kiddo831007(at)gmail(dot)com> wrote:

> hi community
>
> This is the first time for me to submit a patch to Postgres community.
>
> instead of using for loop to find the most significant bit set. we could
> use __builtin_clz function to first find the number of leading zeros for
> the mask and then we can find the index by 32 - __builtin_clz(mask).
>

Hi!

This file has already been removed, as of 4f1f5a7f85. Which already uses
__builtin_clz if it' available.

Were you perhaps looking at an old version instead of the master branch?

--
Magnus Hagander
Me: https://www.hagander.net/ <http://www.hagander.net/>
Work: https://www.redpill-linpro.com/ <http://www.redpill-linpro.com/>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2023-02-25 21:44:01 Evaluate arguments of correlated SubPlans in the referencing ExprState
Previous Message Regina Obe 2023-02-25 20:40:24 RE: Ability to reference other extensions by schema in extension scripts