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);
418 static APInt getMaxValue(unsigned numBits) {
419 return getAllOnesValue(numBits);
423 static APInt getSignedMaxValue(unsigned numBits) {
424 APInt API = getAllOnesValue(numBits);
425 API.clearBit(numBits - 1);
430 static APInt getMinValue(unsigned numBits) { return APInt(numBits, 0); }
433 static APInt getSignedMinValue(unsigned numBits) {
434 APInt API(numBits, 0);
435 API.setBit(numBits - 1);
450 static APInt getAllOnesValue(unsigned numBits) {
451 return APInt(numBits, UINT64_MAX, true);
457 static APInt getNullValue(unsigned numBits) { return APInt(numBits, 0); }
459 /// \brief Compute an APInt containing numBits highbits from this APInt.
464 /// \returns the high "numBits" bits of this APInt.
465 APInt getHiBits(unsigned numBits) const;
467 /// \brief Compute an APInt containing numBits lowbits from this APInt.
472 /// \returns the low "numBits" bits of this APInt.
473 APInt getLoBits(unsigned numBits) const;
476 static APInt getOneBitSet(unsigned numBits, unsigned BitNo) {
477 APInt Res(numBits, 0);
490 /// \param numBits the intended bit width of the result
495 static APInt getBitsSet(unsigned numBits, unsigned loBit, unsigned hiBit) {
496 assert(hiBit <= numBits && "hiBit out of range");
497 assert(loBit < numBits && "loBit out of range");
499 return getLowBitsSet(numBits, hiBit) |
500 getHighBitsSet(numBits, numBits - loBit);
501 return getLowBitsSet(numBits, hiBit - loBit).shl(loBit);
508 /// \param numBits the bitwidth of the result
510 static APInt getHighBitsSet(unsigned numBits, unsigned hiBitsSet) {
511 assert(hiBitsSet <= numBits && "Too many bits to set!");
514 return APInt(numBits, 0);
515 unsigned shiftAmt = numBits - hiBitsSet;
517 if (numBits <= APINT_BITS_PER_WORD)
518 return APInt(numBits, ~0ULL << shiftAmt);
519 return getAllOnesValue(numBits).shl(shiftAmt);
526 /// \param numBits the bitwidth of the result
528 static APInt getLowBitsSet(unsigned numBits, unsigned loBitsSet) {
529 assert(loBitsSet <= numBits && "Too many bits to set!");
532 return APInt(numBits, 0);
534 return APInt(numBits, UINT64_MAX);
537 return APInt(numBits, UINT64_MAX >> (APINT_BITS_PER_WORD - loBitsSet));
538 return getAllOnesValue(numBits).lshr(numBits - loBitsSet);
1711 inline bool isMask(unsigned numBits, const APInt &APIVal) {
1712 return numBits <= APIVal.getBitWidth() &&
1713 APIVal == APInt::getLowBitsSet(APIVal.getBitWidth(), numBits);
1718 inline bool isShiftedMask(unsigned numBits, const APInt &APIVal) {
1719 return isMask(numBits, (APIVal - APInt(numBits, 1)) | APIVal);