add a helper method.

llvm-svn: 125453
This commit is contained in:
Chris Lattner 2011-02-13 08:04:16 +00:00
parent 9f5055f037
commit a61abfaf4c
1 changed files with 7 additions and 0 deletions

View File

@ -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