[llvm] [APInt] Added APInt::clearBits() method (PR #137098)

Dan German via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 24 01:13:26 PDT 2025


================
@@ -2520,6 +2520,62 @@ TEST(APIntTest, setAllBits) {
   EXPECT_EQ(128u, i128.popcount());
 }
 
+TEST(APIntTest, clearBits) {
----------------
dan-german wrote:

Tip: tests might be shorter and clearer with the string‑based `APInt` ctor:
```cpp
APInt hi = APInt::getAllOnes(64);
hi.clearBits(0, 32);
EXPECT_EQ(APInt(64, "FFFFFFFF00000000", 16), hi);
```

https://github.com/llvm/llvm-project/pull/137098


More information about the llvm-commits mailing list