[llvm-commits] [llvm] r47379 - /llvm/trunk/include/llvm/ADT/APInt.h
Dan Gohman
gohman at apple.com
Wed Feb 20 08:08:21 PST 2008
Author: djg
Date: Wed Feb 20 10:08:11 2008
New Revision: 47379
URL: http://llvm.org/viewvc/llvm-project?rev=47379&view=rev
Log:
Add an intersects method to APInt, to capture a common idiom.
Modified:
llvm/trunk/include/llvm/ADT/APInt.h
Modified: llvm/trunk/include/llvm/ADT/APInt.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/APInt.h?rev=47379&r1=47378&r2=47379&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/APInt.h (original)
+++ llvm/trunk/include/llvm/ADT/APInt.h Wed Feb 20 10:08:11 2008
@@ -778,6 +778,12 @@
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
/// @{
More information about the llvm-commits
mailing list