[PATCH] D30265: [APInt] Add APInt::setBits() method to set all bits in range

Filipe Cabecinhas via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 23 03:33:45 PST 2017


filcab added inline comments.


================
Comment at: include/llvm/ADT/APInt.h:1244
+  ///
+  /// Set the bits from loBit (inclusive) to hiBit (exclusive) to 1.
+  /// If hiBit is less than loBit then the set bits "wrap".
----------------
I don't think you need to repeat that sentence.
I'd also suggest removing `\brief`, but I'm ok with keeping it consistent.


================
Comment at: unittests/ADT/APIntTest.cpp:152
+
+  s128.setBits(63, 1);
+  EXPECT_EQ(0u, s128.countLeadingZeros());
----------------
Missing a test for `!isSingleWord() && loBit <= HiBit`
(I'd actually prefer one for `loBit < hiBit` and one for `loBit == HiBit`, to make it explicit what you expect to happen on the edge case)


Repository:
  rL LLVM

https://reviews.llvm.org/D30265





More information about the llvm-commits mailing list