[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
Thu Feb 23 13:27:17 PST 2017


hans added a comment.

In https://reviews.llvm.org/D30265#684965, @RKSimon wrote:

> I didn't do the UINT64_MAX  >> (64 - whichBit(hiBit - 1)) change to avoid having to handle the shift by 64 case


Oh, I used `whichBit(hiBit)` instead of `whichBit(hiBit - 1)`, which isn't right because `hiWord` refers to the highest word where we want set at least one bit.

So how about `UINT64_MAX >> (64 - whichBit(hiBit - 1) - 1)`?

Your solution is fine too, but it fells like this should be possible.


Repository:
  rL LLVM

https://reviews.llvm.org/D30265





More information about the llvm-commits mailing list