[PATCH] D30265: [APInt] Add APInt::setBits() method to set all bits in range
Hans Wennborg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Feb 22 13:22:56 PST 2017
hans added inline comments.
================
Comment at: lib/Support/APInt.cpp:574
+ *this |= APInt::getBitsSet(BitWidth, loBit, hiBit);
+ else if (hiBit < loBit) {
+ for (unsigned bit = 0; bit != hiBit; ++bit)
----------------
Is the `hiBit < loBit` case common?
If not (or maybe even then) perhaps just `setBits(0, hiBit); setBits(loBit, BitWidth); return` and focus on the `loBit < hiBit` case below?
================
Comment at: lib/Support/APInt.cpp:580
+ } else {
+ for (unsigned bit = loBit; bit != hiBit; ++bit)
+ setBit(bit);
----------------
Would it be worth trying to do this word-by-word instead?
Repository:
rL LLVM
https://reviews.llvm.org/D30265
More information about the llvm-commits
mailing list