[llvm-commits] CVS: llvm/include/llvm/Support/MathExtras.h
Reid Spencer
reid at x10sys.com
Wed Jun 21 14:55:06 PDT 2006
Changes in directory llvm/include/llvm/Support:
MathExtras.h updated: 1.30 -> 1.31
---
Log message:
Use C++ style casts instead of C-style casts to shut up compiler warnings
when compiling with -pedantic. Passes regression tests on Linux.
---
Diffs of the changes: (+18 -6)
MathExtras.h | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 deletions(-)
Index: llvm/include/llvm/Support/MathExtras.h
diff -u llvm/include/llvm/Support/MathExtras.h:1.30 llvm/include/llvm/Support/MathExtras.h:1.31
--- llvm/include/llvm/Support/MathExtras.h:1.30 Wed May 24 14:21:13 2006
+++ llvm/include/llvm/Support/MathExtras.h Wed Jun 21 16:54:54 2006
@@ -34,12 +34,24 @@
}
// 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.)
More information about the llvm-commits
mailing list