From d3eefdde34982f0cbe39801d2860243d73309fb8 Mon Sep 17 00:00:00 2001 From: Tsuda Kageyu Date: Wed, 2 Apr 2014 13:46:48 +0900 Subject: [PATCH] Removed some unnecessary CMake checks for the size of numeric types. --- ConfigureChecks.cmake | 6 ------ config.h.cmake | 5 ----- taglib/toolkit/tbytevector.cpp | 18 +++++------------- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/ConfigureChecks.cmake b/ConfigureChecks.cmake index 37550371..5595949a 100644 --- a/ConfigureChecks.cmake +++ b/ConfigureChecks.cmake @@ -39,12 +39,6 @@ else() set(SYSTEM_BYTEORDER 2) endif() -# Determine the size of floating point types. - -check_type_size("float" SIZEOF_FLOAT) -check_type_size("double" SIZEOF_DOUBLE) -check_type_size("long double" SIZEOF_LONGDOUBLE) - # Determine which kind of byte swap functions your compiler supports. # GCC's __builtin_bswap* should be checked individually diff --git a/config.h.cmake b/config.h.cmake index 9ffb4d4f..d22e27ea 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -4,11 +4,6 @@ /* 1 if little-endian, 2 if big-endian. */ #cmakedefine SYSTEM_BYTEORDER ${SYSTEM_BYTEORDER} -/* Size of floating point types */ -#cmakedefine SIZEOF_FLOAT ${SIZEOF_FLOAT} -#cmakedefine SIZEOF_DOUBLE ${SIZEOF_DOUBLE} -#cmakedefine SIZEOF_LONGDOUBLE ${SIZEOF_LONGDOUBLE} - /* Defined if your compiler supports some byte swap functions */ #cmakedefine HAVE_GCC_BYTESWAP_16 1 #cmakedefine HAVE_GCC_BYTESWAP_32 1 diff --git a/taglib/toolkit/tbytevector.cpp b/taglib/toolkit/tbytevector.cpp index 4a02dbc7..e301ccf5 100644 --- a/taglib/toolkit/tbytevector.cpp +++ b/taglib/toolkit/tbytevector.cpp @@ -685,9 +685,7 @@ float ByteVector::toFloat32BE(size_t offset) const return 0.0; } -#if defined(SIZEOF_FLOAT) && SIZEOF_FLOAT == 4 - - if(std::numeric_limits::is_iec559) + if(sizeof(float) == 4 && std::numeric_limits::is_iec559) { // float is 32-bit wide and IEEE754 compliant. @@ -703,8 +701,6 @@ float ByteVector::toFloat32BE(size_t offset) const return tmp.f; } -#endif - const uchar *bytes = reinterpret_cast(data() + offset); // 1-bit sign @@ -721,7 +717,7 @@ float ByteVector::toFloat32BE(size_t offset) const | (static_cast(bytes[3])); float val; - if (exponent == 0 && fraction == 0) + if(exponent == 0 && fraction == 0) val = 0; else { if(exponent == 0xFF) { @@ -745,9 +741,7 @@ double ByteVector::toFloat64BE(size_t offset) const return 0.0; } -#if defined(SIZEOF_DOUBLE) && SIZEOF_DOUBLE == 8 - - if(std::numeric_limits::is_iec559) + if(sizeof(double) == 8 && std::numeric_limits::is_iec559) { // double is 64-bit wide and IEEE754 compliant. @@ -763,8 +757,6 @@ double ByteVector::toFloat64BE(size_t offset) const return tmp.f; } -#endif - const uchar *bytes = reinterpret_cast(data() + offset); // 1-bit sign @@ -785,7 +777,7 @@ double ByteVector::toFloat64BE(size_t offset) const | (static_cast(bytes[7])); double val; - if (exponent == 0 && fraction == 0) + if(exponent == 0 && fraction == 0) val = 0; else { if(exponent == 0x7FF) { @@ -829,7 +821,7 @@ long double ByteVector::toFloat80BE(size_t offset) const | (static_cast(bytes[9])); long double val; - if (exponent == 0 && fraction == 0) + if(exponent == 0 && fraction == 0) val = 0; else { if(exponent == 0x7FFF) {