aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Gohman <gohman@apple.com>2008-02-20 16:08:11 +0000
committerDan Gohman <gohman@apple.com>2008-02-20 16:08:11 +0000
commitbd999178929c10bdeb0a2577fa02981778edaee7 (patch)
treeb5a8754c2ed3867672d5e3f47ced2fbbedae10e3
parent45982a536480efeadb70d3a67b8f9bf5b99ee849 (diff)
Add an intersects method to APInt, to capture a common idiom.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@47379 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/llvm/ADT/APInt.h6
1 files changed, 6 insertions, 0 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h
index fdb1fa47f5..d5d4d520cc 100644
--- a/include/llvm/ADT/APInt.h
+++ b/include/llvm/ADT/APInt.h
@@ -778,6 +778,12 @@ public:
return !slt(RHS);
}
+ /// This operation tests if there are any pairs of corresponding bits
+ /// between this APInt and RHS that are both set.
+ bool intersects(const APInt &RHS) const {
+ return (*this & RHS) != 0;
+ }
+
/// @}
/// @name Resizing Operators
/// @{