Re: use __builtin_clz to compute most significant bit set

2023-02-25 Thread Magnus Hagander
On Sat, Feb 25, 2023 at 9:32 PM Joseph Yu 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

use __builtin_clz to compute most significant bit set

2023-02-25 Thread Joseph Yu
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)