diff options
author | Chris Lattner <sabre@nondot.org> | 2011-02-13 08:04:16 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2011-02-13 08:04:16 +0000 |
commit | 16e036fa8f1d1da02deeaf9a77951f4dc711faa1 (patch) | |
tree | d0eb9c3e882267db755d042b561923f91a06631b /include/llvm/ADT/APInt.h | |
parent | d91ef79c4342ab8949964a4cab3cbbf22b5e678a (diff) | |
download | external_llvm-16e036fa8f1d1da02deeaf9a77951f4dc711faa1.zip external_llvm-16e036fa8f1d1da02deeaf9a77951f4dc711faa1.tar.gz external_llvm-16e036fa8f1d1da02deeaf9a77951f4dc711faa1.tar.bz2 |
add a helper method.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@125453 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/ADT/APInt.h')
-rw-r--r-- | include/llvm/ADT/APInt.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/llvm/ADT/APInt.h b/include/llvm/ADT/APInt.h index 33d1dc9..b91d5dc 100644 --- a/include/llvm/ADT/APInt.h +++ b/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 |