From 54cb98578ac2eff4d5986eff7d2b18c66561d683 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Wed, 21 Jun 2006 21:54:54 +0000 Subject: [PATCH] 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 --- include/llvm/Support/MathExtras.h | 24 ++++++++++++++++++------ 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/include/llvm/Support/MathExtras.h b/include/llvm/Support/MathExtras.h index ed21bb05260..7cc5333562d 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(Value) == Value; +} +inline bool isUInt8 (int Value) { + return static_cast(Value) == Value; +} +inline bool isInt16 (int Value) { + return static_cast(Value) == Value; +} +inline bool isUInt16(int Value) { + return static_cast(Value) == Value; +} +inline bool isInt32 (int64_t Value) { + return static_cast(Value) == Value; +} +inline bool isUInt32(int64_t Value) { + return static_cast(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.) -- 2.34.1