[PATCH] D31802: Add methods to find the next *unset* bits in a bit vector

Daniel Berlin via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Apr 10 11:06:02 PDT 2017


dberlin added inline comments.


================
Comment at: llvm/include/llvm/ADT/BitVector.h:206
+    BitWord Copy = Bits[WordPos];
+    // Mask in previous bits.
+    BitWord Mask = (1 << BitPos) - 1;
----------------
Remind me what endianness we use ?
I would have expected it to simply be << some number of bits, then countleadingones.
It looks reversed, so i'm assuming i'm thinking the wrong way around :)



================
Comment at: llvm/include/llvm/ADT/BitVector.h:220
+        return Result < size() ? Result : -1;
+      }
+    return -1;
----------------
It would be nice to factor this out with the copy above the loop into a little helper function that takes and Bits.




https://reviews.llvm.org/D31802





More information about the llvm-commits mailing list