Index: llvm/include/llvm/Support/MathExtras.h =================================================================== --- llvm/include/llvm/Support/MathExtras.h +++ llvm/include/llvm/Support/MathExtras.h @@ -461,6 +461,12 @@ return N >= 64 || (minIntN(N) <= x && x <= maxIntN(N)); } +/// Checks if an unsigned integer is an N bit number shifted left by S. Dynamic +/// version of isShiftedUInt. +inline bool isShiftedUIntN(unsigned N, unsigned S, uint64_t x) { + return isUIntN(N + S, x) && (x % (UINT64_C(1) << S) == 0); +} + /// Return true if the argument is a non-empty sequence of ones starting at the /// least significant bit with the remainder zero (32 bit version). /// Ex. isMask_32(0x0000FFFFU) == true.