llvm.org GIT mirror llvm / 71f95b8
random cleanup git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@57383 91177308-0d34-0410-b5e6-96231b3b80d8 Chris Lattner 11 years ago
1 changed file(s) with 1 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
457457 /// @param numBits the bitwidth of the result
458458 /// @param loBitsSet the number of low-order bits set in the result.
459459 /// @brief Get a value with low bits set
460 // XXX why isn't this inlining?
461460 static APInt getLowBitsSet(uint32_t numBits, uint32_t loBitsSet) {
462461 assert(loBitsSet <= numBits && "Too many bits to set!");
463462 // Handle a degenerate case, to avoid shifting by word size
465464 return APInt(numBits, 0);
466465 if (loBitsSet == APINT_BITS_PER_WORD)
467466 return APInt(numBits, -1ULL);
468 // For small values, return quickly
467 // For small values, return quickly.
469468 if (numBits < APINT_BITS_PER_WORD)
470469 return APInt(numBits, (1ULL << loBitsSet) - 1);
471470 return (~APInt(numBits, 0)).lshr(numBits - loBitsSet);