summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2011-02-13 08:04:16 +0000
committerChris Lattner <sabre@nondot.org>2011-02-13 08:04:16 +0000
commita61abfaf4c3096f76f0e135c411ef8e7b8e030ee (patch)
tree9fd478432e2ac00b03e8e1c86d54069263d59bd9
parent9f5055f037c927a0b8b3d44fbebf0c2d0adb6962 (diff)
downloadbcm5719-llvm-a61abfaf4c3096f76f0e135c411ef8e7b8e030ee.tar.gz
bcm5719-llvm-a61abfaf4c3096f76f0e135c411ef8e7b8e030ee.zip
add a helper method.
llvm-svn: 125453
-rw-r--r--llvm/include/llvm/ADT/APInt.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/include/llvm/ADT/APInt.h b/llvm/include/llvm/ADT/APInt.h
index 33d1dc9ec01..b91d5dc9bcf 100644
--- a/llvm/include/llvm/ADT/APInt.h
+++ b/llvm/include/llvm/ADT/APInt.h
@@ -431,6 +431,13 @@ public:
/// @returns the low "numBits" bits of this APInt.
APInt getLoBits(unsigned numBits) const;
+ /// getOneBitSet - Return an APInt with exactly one bit set in the result.
+ static APInt getOneBitSet(unsigned numBits, unsigned BitNo) {
+ APInt Res(numBits, 0);
+ Res.setBit(BitNo);
+ return Res;
+ }
+
/// Constructs an APInt value that has a contiguous range of bits set. The
/// bits from loBit (inclusive) to hiBit (exclusive) will be set. All other
/// bits will be zero. For example, with parameters(32, 0, 16) you would get
OpenPOWER on IntegriCloud