Add new -d option to tblgen. It writes a make(1)-style dependency file.
[oota-llvm.git] / include / llvm / Support / MathExtras.h
index 6740786dec7e642b8711015e42c7ab861b37ce29..4627557f7f1f05b2fe4382461d69527cc9a67ba4 100644 (file)
@@ -76,6 +76,12 @@ inline bool isUIntN(unsigned N, uint64_t x) {
   return x == (x & (~0ULL >> (64 - N)));
 }
 
+/// isIntN - Checks if an signed integer fits into the given (dynamic)
+/// bit width.
+inline bool isIntN(unsigned N, int64_t x) {
+  return N >= 64 || (-(INT64_C(1)<<(N-1)) <= x && x < (INT64_C(1)<<(N-1)));
+}
+
 /// isMask_32 - This function returns true if the argument is a sequence of ones
 /// starting at the least significant bit with the remainder zero (32 bit
 /// version).   Ex. isMask_32(0x0000FFFFU) == true.