[all-commits] [llvm/llvm-project] 49f7d2: [Support] Use llvm::countr_zero and llvm::Log2_64 ...

kazutakahirata via All-commits all-commits at lists.llvm.org
Wed Jan 25 21:22:24 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 49f7d2c4f0fa105a854c2aee78347652212ace3d
      https://github.com/llvm/llvm-project/commit/49f7d2c4f0fa105a854c2aee78347652212ace3d
  Author: Kazu Hirata <kazu at google.com>
  Date:   2023-01-25 (Wed, 25 Jan 2023)

  Changed paths:
    M llvm/lib/Support/APInt.cpp

  Log Message:
  -----------
  [Support] Use llvm::countr_zero and llvm::Log2_64 in APInt.cpp (NFC)

partMSB and partLSB never get 0 as the argument.  That is, we don't
rely on find{First,Last}Set's ability to return
std::numeric_limits<T>::max() on input 0.

This patch replaces partLSB and partMSB with llvm::countr_zero and
llvm::Log2_64, respectively.

FWIW, nobody in LLVM (except unit test MathExtrasTest.cpp) relies on
find{First,Last}Set's ability to return std::numeric_limits<T>::max()
on input 0.




More information about the All-commits mailing list