Use C++ style casts instead of C-style casts to shut up compiler warnings
authorReid Spencer <rspencer@reidspencer.com>
Wed, 21 Jun 2006 21:54:54 +0000 (21:54 +0000)
committerReid Spencer <rspencer@reidspencer.com>
Wed, 21 Jun 2006 21:54:54 +0000 (21:54 +0000)
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

include/llvm/Support/MathExtras.h

index ed21bb05260bd9d18606ef3bbab42f1f3a0bcb7d..7cc5333562d266359c182deacc49f756846e7a7d 100644 (file)
@@ -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.)