Lines Matching defs:numBits

172   void fromString(unsigned numBits, StringRef str, uint8_t radix);
184 void initSlowCase(unsigned numBits, uint64_t val, bool isSigned);
226 /// \brief Create a new APInt of numBits width, initialized as val.
233 /// \param numBits the bit width of the constructed APInt
236 APInt(unsigned numBits, uint64_t val, bool isSigned = false)
237 : BitWidth(numBits), VAL(0) {
242 initSlowCase(numBits, val, isSigned);
246 /// \brief Construct an APInt of numBits width, initialized as bigVal[].
251 /// \param numBits the bit width of the constructed APInt
253 APInt(unsigned numBits, ArrayRef<uint64_t> bigVal);
255 /// Equivalent to APInt(numBits, ArrayRef<uint64_t>(bigVal, numWords)), but
262 APInt(unsigned numBits, unsigned numWords, const uint64_t bigVal[]);
270 /// string to require more bits than numBits.
272 /// \param numBits the bit width of the constructed APInt
275 APInt(unsigned numBits, StringRef str, uint8_t radix);
416 static APInt getMaxValue(unsigned numBits) {
417 return getAllOnesValue(numBits);
421 static APInt getSignedMaxValue(unsigned numBits) {
422 APInt API = getAllOnesValue(numBits);
423 API.clearBit(numBits - 1);
428 static APInt getMinValue(unsigned numBits) { return APInt(numBits, 0); }
431 static APInt getSignedMinValue(unsigned numBits) {
432 APInt API(numBits, 0);
433 API.setBit(numBits - 1);
448 static APInt getAllOnesValue(unsigned numBits) {
449 return APInt(numBits, UINT64_MAX, true);
455 static APInt getNullValue(unsigned numBits) { return APInt(numBits, 0); }
457 /// \brief Compute an APInt containing numBits highbits from this APInt.
462 /// \returns the high "numBits" bits of this APInt.
463 APInt getHiBits(unsigned numBits) const;
465 /// \brief Compute an APInt containing numBits lowbits from this APInt.
470 /// \returns the low "numBits" bits of this APInt.
471 APInt getLoBits(unsigned numBits) const;
474 static APInt getOneBitSet(unsigned numBits, unsigned BitNo) {
475 APInt Res(numBits, 0);
488 /// \param numBits the intended bit width of the result
493 static APInt getBitsSet(unsigned numBits, unsigned loBit, unsigned hiBit) {
494 assert(hiBit <= numBits && "hiBit out of range");
495 assert(loBit < numBits && "loBit out of range");
497 return getLowBitsSet(numBits, hiBit) |
498 getHighBitsSet(numBits, numBits - loBit);
499 return getLowBitsSet(numBits, hiBit - loBit).shl(loBit);
506 /// \param numBits the bitwidth of the result
508 static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet) {
509 assert(hiBitsSet <= numBits && "Too many bits to set!");
512 return APInt(numBits, 0);
513 unsigned shiftAmt = numBits - hiBitsSet;
515 if (numBits <= APINT_BITS_PER_WORD)
516 return APInt(numBits, ~0ULL << shiftAmt);
517 return getAllOnesValue(numBits).shl(shiftAmt);
524 /// \param numBits the bitwidth of the result
526 static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet) {
527 assert(loBitsSet <= numBits && "Too many bits to set!");
530 return APInt(numBits, 0);
532 return APInt(numBits, UINT64_MAX);
535 return APInt(numBits, UINT64_MAX >> (APINT_BITS_PER_WORD - loBitsSet));
536 return getAllOnesValue(numBits).lshr(numBits - loBitsSet);
1742 inline bool isMask(unsigned numBits, const APInt &APIVal) {
1743 return numBits <= APIVal.getBitWidth() &&
1744 APIVal == APInt::getLowBitsSet(APIVal.getBitWidth(), numBits);
1749 inline bool isShiftedMask(unsigned numBits, const APInt &APIVal) {
1750 return isMask(numBits, (APIVal - APInt(numBits, 1)) | APIVal);