diff options
author | Reid Spencer <rspencer@reidspencer.com> | 2006-06-21 21:54:54 +0000 |
---|---|---|
committer | Reid Spencer <rspencer@reidspencer.com> | 2006-06-21 21:54:54 +0000 |
commit | 54cb98578ac2eff4d5986eff7d2b18c66561d683 (patch) | |
tree | 163412363df26d0331d9a3d43464461dc40b3377 /include/llvm/Support/MathExtras.h | |
parent | 8eb12def01ac68fecdff615c35d80ea293c94741 (diff) |
Use C++ style casts instead of C-style casts to shut up compiler warnings
when compiling with -pedantic. Passes regression tests on Linux.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@28904 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/llvm/Support/MathExtras.h')
-rw-r--r-- | include/llvm/Support/MathExtras.h | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h index ed21bb0526..7cc5333562 100644 --- a/include/llvm/Support/MathExtras.h +++ b/include/llvm/Support/MathExtras.h @@ -34,12 +34,24 @@ inline unsigned Lo_32(uint64_t Value) { } // is?Type - these functions produce optimal testing for integer data types. -inline bool isInt8 (int Value) { return ( signed char )Value == Value; } -inline bool isUInt8 (int Value) { return (unsigned char )Value == Value; } -inline bool isInt16 (int Value) { return ( signed short)Value == Value; } -inline bool isUInt16(int Value) { return (unsigned short)Value == Value; } -inline bool isInt32 (int64_t Value) { return ( signed int )Value == Value; } -inline bool isUInt32(int64_t Value) { return (unsigned int )Value == Value; } +inline bool isInt8 (int Value) { + return static_cast<signed char>(Value) == Value; +} +inline bool isUInt8 (int Value) { + return static_cast<unsigned char>(Value) == Value; +} +inline bool isInt16 (int Value) { + return static_cast<signed short>(Value) == Value; +} +inline bool isUInt16(int Value) { + return static_cast<unsigned short>(Value) == Value; +} +inline bool isInt32 (int64_t Value) { + return static_cast<signed int>(Value) == Value; +} +inline bool isUInt32(int64_t Value) { + return static_cast<unsigned int>(Value) == Value; +} // 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.) |