[PATCH] D81325: [APInt] set all bits for getBitsSetWithWrap if loBit == hiBit

ChenZheng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Jun 6 06:22:54 PDT 2020


shchenz added inline comments.


================
Comment at: llvm/include/llvm/ADT/APInt.h:621
+  /// If \p hiBit is not bigger than \p loBit, the set bits "wrap". For example,
+  /// with parameters (32, 28, 4), you would get 0xF000000F.
   static APInt getBitsSetWithWrap(unsigned numBits, unsigned loBit,
----------------
RKSimon wrote:
> We probably should explicitly explain the loBit == hiBit case here and for setBitsWithWrap
Good idea.


================
Comment at: llvm/include/llvm/ADT/APInt.h:1459
       return;
+    } else if (loBit == hiBit) {
+      // Get all bits set if loBit == hiBit for wrap case.
----------------
lkail wrote:
> Have no knowledge of this method's semantics, what this branch does should equal to the block following.
Good catch!


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D81325





More information about the llvm-commits mailing list