[llvm] Use Log2_64_Ceil to compute PowerOf2Ceil (PR #67580)

via llvm-commits llvm-commits at lists.llvm.org
Wed Oct 18 03:01:57 PDT 2023


rilysh wrote:

The current implemention of `NextPowerOf2` seems to be the most portable way to achieve the power of 2, which is equivalent to `int(pow(2, ceil(log2(x))))`. Only noticeable difference to me is that in the PR implementation, if `x > (UINT32_MAX + 1)`, the current `NextPowerOf2` and PR changes of that function will yield different results.

https://github.com/llvm/llvm-project/pull/67580


More information about the llvm-commits mailing list