Alvaro Herrera <alvhe...@2ndquadrant.com> writes: > On 2019-Dec-27, Tom Lane wrote: >> ... Perhaps what we really ought to be working on is >> finding MSVC equivalents for __builtin_clz and friends.
> Apparently clz() can be written using _BitScanReverse(), per > https://stackoverflow.com/a/20468180 > https://docs.microsoft.com/en-us/cpp/intrinsics/bitscanreverse-bitscanreverse64?view=vs-2015 Yeah, I found that too. It looks promising, but we need to look into * portability to different MSVC versions? (I guess the buildfarm would tell us) * performance, does it actually generate comparable code? * intrinsics for the other bit instructions we use? regards, tom lane