[libcxx-commits] [PATCH] D134625: Summary:bug fix! Rotation direction on `__countl_zero()`probably unnoticed because only affects rare cases(does not affect 128 bit ints because rotation is effectively swap)(does not affect integers of sizes less or equal to 64bits)

Armando Martín via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Sep 26 14:48:53 PDT 2022


Delta-dev-99 added a comment.

Possible test case: apply the operation to 256-bit integer 0x8000000000000000000000000000000000000000000000000000000000000000 (first bit from the left is set, all other bits cleared)
Correct answer: 0. The first bit from the left is set.
Current implementation's answer (probably, not tested yet): 128. It counts the bits cleared in the 2 blocks (64 bits each) in the middle of the number (bits 64 to 191) before finding the bit set in the left-most block (block 4).

Another possible test case: 256-bit integer 0x0000000000000000000000000000000080000000000000000000000000000000 (bit 127 is set, which is the left-most bit of block 2, all other bits cleared)
Correct answer: 128
Current implementation's answer (probably, not tested yet): 0


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D134625/new/

https://reviews.llvm.org/D134625



More information about the libcxx-commits mailing list