diff options
-rwxr-xr-x | config.tests/unix/doubleformat.test | 63 | ||||
-rw-r--r-- | config.tests/unix/doubleformat/doubleformattest.cpp | 66 | ||||
-rw-r--r-- | config.tests/unix/doubleformat/doubleformattest.pro | 3 | ||||
-rwxr-xr-x | configure | 86 | ||||
-rw-r--r-- | src/corelib/global/qnumeric_p.h | 42 | ||||
-rw-r--r-- | src/corelib/io/qdatastream.cpp | 69 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_tools.cpp | 44 | ||||
-rw-r--r-- | src/corelib/tools/qlocale_tools_p.h | 4 | ||||
-rw-r--r-- | tests/auto/corelib/tools/qlocale/tst_qlocale.cpp | 4 | ||||
-rw-r--r-- | tests/auto/corelib/tools/qstring/tst_qstring.cpp | 11 | ||||
-rw-r--r-- | tests/auto/other/compiler/tst_compiler.cpp | 10 |
11 files changed, 7 insertions, 395 deletions
diff --git a/config.tests/unix/doubleformat.test b/config.tests/unix/doubleformat.test deleted file mode 100755 index 996855372b..0000000000 --- a/config.tests/unix/doubleformat.test +++ /dev/null @@ -1,63 +0,0 @@ -#!/bin/sh - -QMKSPEC=$1 -VERBOSE=$2 -SRCDIR=$3 -OUTDIR=$4 - -# debuggery -[ "$VERBOSE" = "yes" ] && echo "Determining floating point word-order... ($*)" - -# build and run a test program -test -d "$OUTDIR/config.tests/unix/doubleformat" || mkdir -p "$OUTDIR/config.tests/unix/doubleformat" -"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/config.tests/unix/doubleformat/doubleformattest.pro" -o "$OUTDIR/config.tests/unix/doubleformat/Makefile" >/dev/null 2>&1 -cd "$OUTDIR/config.tests/unix/doubleformat" - -DOUBLEFORMAT="UNKNOWN" -[ "$VERBOSE" = "yes" ] && $MAKE || $MAKE >/dev/null 2>&1 - -if [ -f ./doubleformattest ]; then - : # nop -else - [ "$VERBOSE" = "yes" ] && echo "Unknown floating point format!" - exit 2 -fi - -# LE: strings | grep 0123ABCD0123ABCD -# BE: strings | grep DCBA3210DCBA3210 -# -# LE arm-swapped-dword-order: strings | grep ABCD0123ABCD0123 -# BE arm-swapped-dword-order: strings | grep 3210DCBA3210DCBA (untested) - - -if strings ./doubleformattest | grep "0123ABCD0123ABCD" >/dev/null 2>&1; then - [ "$VERBOSE" = "yes" ] && echo " Normal little endian format" - DOUBLEFORMAT="LITTLE" -elif strings ./doubleformattest | grep "ABCD0123ABCD0123" >/dev/null 2>&1; then - [ "$VERBOSE" = "yes" ] && echo " Swapped little endian format" - DOUBLEFORMAT="LITTLESWAPPED" -elif strings ./doubleformattest | grep "DCBA3210DCBA3210" >/dev/null 2>&1; then - [ "$VERBOSE" = "yes" ] && echo " Normal big endian format" - DOUBLEFORMAT="BIG" -elif strings ./doubleformattest | grep "3210DCBA3210DCBA" >/dev/null 2>&1; then - [ "$VERBOSE" = "yes" ] && echo " Swapped big endian format" - DOUBLEFORMAT="BIGSWAPPED" -fi - -# done -if [ "$DOUBLEFORMAT" = "LITTLE" ]; then - [ "$VERBOSE" = "yes" ] && echo "Using little endian." - exit 10 -elif [ "$DOUBLEFORMAT" = "BIG" ]; then - [ "$VERBOSE" = "yes" ] && echo "Using big endian." - exit 11 -elif [ "$DOUBLEFORMAT" = "LITTLESWAPPED" ]; then - [ "$VERBOSE" = "yes" ] && echo "Using swapped little endian." - exit 12 -elif [ "$DOUBLEFORMAT" = "BIGSWAPPED" ]; then - [ "$VERBOSE" = "yes" ] && echo "Using swapped big endian." - exit 13 -else - [ "$VERBOSE" = "yes" ] && echo "Unknown floating point format!" - exit 99 -fi diff --git a/config.tests/unix/doubleformat/doubleformattest.cpp b/config.tests/unix/doubleformat/doubleformattest.cpp deleted file mode 100644 index 1a182c668a..0000000000 --- a/config.tests/unix/doubleformat/doubleformattest.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). -** Contact: http://www.qt-project.org/ -** -** This file is part of the config.tests of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** GNU Lesser General Public License Usage -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this -** file. Please review the following information to ensure the GNU Lesser -** General Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. -** -** In addition, as a special exception, Nokia gives you certain additional -** rights. These rights are described in the Nokia Qt LGPL Exception -** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU General -** Public License version 3.0 as published by the Free Software Foundation -** and appearing in the file LICENSE.GPL included in the packaging of this -** file. Please review the following information to ensure the GNU General -** Public License version 3.0 requirements will be met: -** http://www.gnu.org/copyleft/gpl.html. -** -** Other Usage -** Alternatively, this file may be used in accordance with the terms and -** conditions contained in a signed written agreement between you and Nokia. -** -** -** -** -** -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -/* - -LE: strings | grep 0123ABCD0123ABCD -BE: strings | grep DCBA3210DCBA3210 - -LE arm-swapped-dword-order: strings | grep ABCD0123ABCD0123 -BE arm-swapped-dword-order: strings | grep 3210DCBA3210DCBA (untested) - -tested on x86, arm-le (gp), aix - -*/ - -#include <stdlib.h> - -// equals static char c [] = "0123ABCD0123ABCD\0\0\0\0\0\0\0" -static double d [] = { 710524581542275055616.0, 710524581542275055616.0, 0.0 }; - -int main(int argc, char **argv) -{ - // make sure the linker doesn't throw away the arrays - double *d2 = (double *) d; - if (argc > 3) - d[1] += 1; - return d2[0] + d[2] + atof(argv[1]); -} diff --git a/config.tests/unix/doubleformat/doubleformattest.pro b/config.tests/unix/doubleformat/doubleformattest.pro deleted file mode 100644 index 7e51deade5..0000000000 --- a/config.tests/unix/doubleformat/doubleformattest.pro +++ /dev/null @@ -1,3 +0,0 @@ -SOURCES = doubleformattest.cpp -CONFIG -= qt dylib -mac:CONFIG -= app_bundle @@ -765,8 +765,6 @@ CFG_NAS=no CFG_ACCESSIBILITY=auto CFG_ENDIAN=auto CFG_HOST_ENDIAN=auto -CFG_DOUBLEFORMAT=auto -CFG_ARMFPA=auto CFG_IWMMXT=no CFG_NEON=auto CFG_CLOCK_GETTIME=auto @@ -961,7 +959,7 @@ while [ "$#" -gt 0 ]; do VAL=no ;; #Qt style yes options - -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-wayland|-nis|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-debug-and-release|-exceptions|-harfbuzz|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-phonon-backend|-audio-backend|-declarative-debug|-javascript-jit|-rpath|-force-pkg-config|-icu|-force-asserts|-testcocoon) + -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-xinput2|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-xcb|-wayland|-nis|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-debug-and-release|-exceptions|-harfbuzz|-prefix-install|-silent|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-phonon-backend|-audio-backend|-declarative-debug|-javascript-jit|-rpath|-force-pkg-config|-icu|-force-asserts|-testcocoon) VAR=`echo $1 | sed "s,^-\(.*\),\1,"` VAL=yes ;; @@ -1248,13 +1246,6 @@ while [ "$#" -gt 0 ]; do UNKNOWN_OPT=yes fi ;; - armfpa) - if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then - CFG_ARMFPA="$VAL" - else - UNKNOWN_OPT=yes - fi - ;; opengl) if [ "$VAL" = "auto" ] || [ "$VAL" = "desktop" ] || [ "$VAL" = "yes" ] || [ "$VAL" = "no" ] || @@ -3204,7 +3195,7 @@ Usage: $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir [-iconv] [-no-pch] [-pch] [-no-dbus] [-dbus] [-dbus-linked] [-no-gui] [-no-separate-debug-info] [-no-mmx] [-no-3dnow] [-no-sse] [-no-sse2] [-no-sse3] [-no-ssse3] [-no-sse4.1] [-no-sse4.2] [-no-avx] [-no-neon] - [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-armfpa] + [-qtnamespace <namespace>] [-qtlibinfix <infix>] [-separate-debug-info] [-no-phonon-backend] [-phonon-backend] [-no-media-backend] [-media-backend] [-no-audio-backend] [-audio-backend] [-no-javascript-jit] [-javascript-jit] [-no-declarative-debug] [-declarative-debug] @@ -3736,12 +3727,6 @@ if [ "$PLATFORM_QPA" = "yes" ]; then -feature-<feature> .. Compile in <feature>. The available features are described in src/corelib/global/qfeatures.txt - -armfpa ............. Target platform uses the ARM-FPA floating point format. - -no-armfpa .......... Target platform does not use the ARM-FPA floating point format. - - The floating point format is usually autodetected by configure. Use this - to override the detected value. - -little-endian ...... Target platform is little endian (LSB first). -big-endian ......... Target platform is big endian (MSB first). @@ -5589,51 +5574,6 @@ if [ "$CFG_HOST_ENDIAN" = "auto" ]; then fi fi -if [ "$CFG_ARMFPA" != "auto" ]; then - if [ "$CFG_ARMFPA" = "yes" ]; then - if [ "$CFG_ENDIAN" = "Q_LITTLE_ENDIAN" ]; then - CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE_SWAPPED" - else - CFG_DOUBLEFORMAT="Q_DOUBLE_BIG_SWAPPED" - fi - else - CFG_DOUBLEFORMAT="normal" - fi -fi - - -if [ "$CFG_DOUBLEFORMAT" = "auto" ]; then - if [ "$PLATFORM_QPA" = "yes" ]; then - CFG_DOUBLEFORMAT=normal - else - "$unixtests/doubleformat.test" "$XQMAKESPEC" $OPT_VERBOSE "$relpath" "$outpath" - F="$?" - if [ "$F" -eq 10 ] && [ "$CFG_ENDIAN" = "Q_LITTLE_ENDIAN" ]; then - CFG_DOUBLEFORMAT=normal - elif [ "$F" -eq 11 ] && [ "$CFG_ENDIAN" = "Q_BIG_ENDIAN" ]; then - CFG_DOUBLEFORMAT=normal - elif [ "$F" -eq 10 ]; then - CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE" - elif [ "$F" -eq 11 ]; then - CFG_DOUBLEFORMAT="Q_DOUBLE_BIG" - elif [ "$F" -eq 12 ]; then - CFG_DOUBLEFORMAT="Q_DOUBLE_LITTLE_SWAPPED" - CFG_ARMFPA="yes" - elif [ "$F" -eq 13 ]; then - CFG_DOUBLEFORMAT="Q_DOUBLE_BIG_SWAPPED" - CFG_ARMFPA="yes" - else - echo - echo "The system floating point format could not be detected." - echo "This may cause data to be generated in a wrong format" - echo "Turn on verbose messaging (-v) to see the final report." - # we do not fail on this since this is a new test, and if it fails, - # the old behavior should be correct in most cases - CFG_DOUBLEFORMAT=normal - fi - fi -fi - HAVE_STL=no if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/stl "STL" $L_FLAGS $I_FLAGS $l_FLAGS; then HAVE_STL=yes @@ -6543,28 +6483,6 @@ else fi echo "#endif" >>"$outpath/src/corelib/global/qconfig.h.new" -if [ "$CFG_DOUBLEFORMAT" != "normal" ]; then - cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF -/* Non-IEEE double format */ -#define Q_DOUBLE_LITTLE "01234567" -#define Q_DOUBLE_BIG "76543210" -#define Q_DOUBLE_LITTLE_SWAPPED "45670123" -#define Q_DOUBLE_BIG_SWAPPED "32107654" -#define Q_DOUBLE_FORMAT $CFG_DOUBLEFORMAT -EOF -fi -if [ "$CFG_ARMFPA" = "yes" ]; then - if [ "$CFG_ARCH" != "$CFG_HOST_ARCH" ]; then - cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF -#ifndef QT_BOOTSTRAPPED -# define QT_ARMFPA -#endif -EOF - else - echo "#define QT_ARMFPA" >>"$outpath/src/corelib/global/qconfig.h.new" - fi -fi - CFG_ARCH_STR=`echo $CFG_ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` CFG_HOST_ARCH_STR=`echo $CFG_HOST_ARCH | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'` cat >>"$outpath/src/corelib/global/qconfig.h.new" <<EOF diff --git a/src/corelib/global/qnumeric_p.h b/src/corelib/global/qnumeric_p.h index 6b5ecf73e1..851c18203d 100644 --- a/src/corelib/global/qnumeric_p.h +++ b/src/corelib/global/qnumeric_p.h @@ -61,63 +61,43 @@ QT_BEGIN_NAMESPACE static const union { unsigned char c[8]; double d; } qt_be_inf_bytes = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } }; static const union { unsigned char c[8]; double d; } qt_le_inf_bytes = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }; -static const union { unsigned char c[8]; double d; } qt_armfpa_inf_bytes = { { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 } }; static inline double qt_inf() { -#ifdef QT_ARMFPA - return qt_armfpa_inf_bytes.d; -#else return (QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_inf_bytes.d : qt_le_inf_bytes.d); -#endif } // Signaling NAN static const union { unsigned char c[8]; double d; } qt_be_snan_bytes = { { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 } }; static const union { unsigned char c[8]; double d; } qt_le_snan_bytes = { { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f } }; -static const union { unsigned char c[8]; double d; } qt_armfpa_snan_bytes = { { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 } }; static inline double qt_snan() { -#ifdef QT_ARMFPA - return qt_armfpa_snan_bytes.d; -#else return (QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_snan_bytes.d : qt_le_snan_bytes.d); -#endif } // Quiet NAN static const union { unsigned char c[8]; double d; } qt_be_qnan_bytes = { { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 } }; static const union { unsigned char c[8]; double d; } qt_le_qnan_bytes = { { 0, 0, 0, 0, 0, 0, 0xf8, 0xff } }; -static const union { unsigned char c[8]; double d; } qt_armfpa_qnan_bytes = { { 0, 0, 0xf8, 0xff, 0, 0, 0, 0 } }; static inline double qt_qnan() { -#ifdef QT_ARMFPA - return qt_armfpa_qnan_bytes.d; -#else return (QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_qnan_bytes.d : qt_le_qnan_bytes.d); -#endif } #else // Q_CC_MIPS static const unsigned char qt_be_inf_bytes[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }; static const unsigned char qt_le_inf_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }; -static const unsigned char qt_armfpa_inf_bytes[] = { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }; static inline double qt_inf() { const unsigned char *bytes; -#ifdef QT_ARMFPA - bytes = qt_armfpa_inf_bytes; -#else bytes = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_inf_bytes : qt_le_inf_bytes); -#endif union { unsigned char c[8]; double d; } returnValue; qMemCopy(returnValue.c, bytes, sizeof(returnValue.c)); @@ -127,17 +107,12 @@ static inline double qt_inf() // Signaling NAN static const unsigned char qt_be_snan_bytes[] = { 0x7f, 0xf8, 0, 0, 0, 0, 0, 0 }; static const unsigned char qt_le_snan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0x7f }; -static const unsigned char qt_armfpa_snan_bytes[] = { 0, 0, 0xf8, 0x7f, 0, 0, 0, 0 }; static inline double qt_snan() { const unsigned char *bytes; -#ifdef QT_ARMFPA - bytes = qt_armfpa_snan_bytes; -#else bytes = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_snan_bytes : qt_le_snan_bytes); -#endif union { unsigned char c[8]; double d; } returnValue; qMemCopy(returnValue.c, bytes, sizeof(returnValue.c)); @@ -147,17 +122,12 @@ static inline double qt_snan() // Quiet NAN static const unsigned char qt_be_qnan_bytes[] = { 0xff, 0xf8, 0, 0, 0, 0, 0, 0 }; static const unsigned char qt_le_qnan_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf8, 0xff }; -static const unsigned char qt_armfpa_qnan_bytes[] = { 0, 0, 0xf8, 0xff, 0, 0, 0, 0 }; static inline double qt_qnan() { const unsigned char *bytes; -#ifdef QT_ARMFPA - bytes = qt_armfpa_qnan_bytes; -#else bytes = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_qnan_bytes : qt_le_qnan_bytes); -#endif union { unsigned char c[8]; double d; } returnValue; qMemCopy(returnValue.c, bytes, sizeof(returnValue.c)); @@ -169,43 +139,31 @@ static inline double qt_qnan() static inline bool qt_is_inf(double d) { uchar *ch = (uchar *)&d; -#ifdef QT_ARMFPA - return (ch[3] & 0x7f) == 0x7f && ch[2] == 0xf0; -#else if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { return (ch[0] & 0x7f) == 0x7f && ch[1] == 0xf0; } else { return (ch[7] & 0x7f) == 0x7f && ch[6] == 0xf0; } -#endif } static inline bool qt_is_nan(double d) { uchar *ch = (uchar *)&d; -#ifdef QT_ARMFPA - return (ch[3] & 0x7f) == 0x7f && ch[2] > 0xf0; -#else if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { return (ch[0] & 0x7f) == 0x7f && ch[1] > 0xf0; } else { return (ch[7] & 0x7f) == 0x7f && ch[6] > 0xf0; } -#endif } static inline bool qt_is_finite(double d) { uchar *ch = (uchar *)&d; -#ifdef QT_ARMFPA - return (ch[3] & 0x7f) != 0x7f || (ch[2] & 0xf0) != 0xf0; -#else if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { return (ch[0] & 0x7f) != 0x7f || (ch[1] & 0xf0) != 0xf0; } else { return (ch[7] & 0x7f) != 0x7f || (ch[6] & 0xf0) != 0xf0; } -#endif } static inline bool qt_is_inf(float d) diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp index 7920d881b4..f3fe91427a 100644 --- a/src/corelib/io/qdatastream.cpp +++ b/src/corelib/io/qdatastream.cpp @@ -771,10 +771,6 @@ QDataStream &QDataStream::operator>>(float &f) return *this; } -#if defined(Q_DOUBLE_FORMAT) -#define Q_DF(x) Q_DOUBLE_FORMAT[(x)] - '0' -#endif - /*! \overload @@ -797,7 +793,6 @@ QDataStream &QDataStream::operator>>(double &f) f = 0.0; CHECK_STREAM_PRECOND(*this) -#ifndef Q_DOUBLE_FORMAT if (dev->read((char *)&f, 8) != 8) { f = 0.0; setStatus(ReadPastEnd); @@ -811,39 +806,6 @@ QDataStream &QDataStream::operator>>(double &f) f = x.val1; } } -#else - //non-standard floating point format - union { - double val1; - char val2[8]; - } x; - char *p = x.val2; - char b[8]; - if (dev->read(b, 8) == 8) { - if (noswap) { - *p++ = b[Q_DF(0)]; - *p++ = b[Q_DF(1)]; - *p++ = b[Q_DF(2)]; - *p++ = b[Q_DF(3)]; - *p++ = b[Q_DF(4)]; - *p++ = b[Q_DF(5)]; - *p++ = b[Q_DF(6)]; - *p = b[Q_DF(7)]; - } else { - *p++ = b[Q_DF(7)]; - *p++ = b[Q_DF(6)]; - *p++ = b[Q_DF(5)]; - *p++ = b[Q_DF(4)]; - *p++ = b[Q_DF(3)]; - *p++ = b[Q_DF(2)]; - *p++ = b[Q_DF(1)]; - *p = b[Q_DF(0)]; - } - f = x.val1; - } else { - setStatus(ReadPastEnd); - } -#endif return *this; } @@ -1112,7 +1074,6 @@ QDataStream &QDataStream::operator<<(double f) } CHECK_STREAM_WRITE_PRECOND(*this) -#ifndef Q_DOUBLE_FORMAT if (noswap) { if (dev->write((char *)&f, sizeof(double)) != sizeof(double)) q_status = WriteFailed; @@ -1126,36 +1087,6 @@ QDataStream &QDataStream::operator<<(double f) if (dev->write((char *)&x.val2, sizeof(double)) != sizeof(double)) q_status = WriteFailed; } -#else - union { - double val1; - char val2[8]; - } x; - x.val1 = f; - char *p = x.val2; - char b[8]; - if (noswap) { - b[Q_DF(0)] = *p++; - b[Q_DF(1)] = *p++; - b[Q_DF(2)] = *p++; - b[Q_DF(3)] = *p++; - b[Q_DF(4)] = *p++; - b[Q_DF(5)] = *p++; - b[Q_DF(6)] = *p++; - b[Q_DF(7)] = *p; - } else { - b[Q_DF(7)] = *p++; - b[Q_DF(6)] = *p++; - b[Q_DF(5)] = *p++; - b[Q_DF(4)] = *p++; - b[Q_DF(3)] = *p++; - b[Q_DF(2)] = *p++; - b[Q_DF(1)] = *p++; - b[Q_DF(0)] = *p; - } - if (dev->write(b, 8) != 8) - q_status = WriteFailed; -#endif return *this; } diff --git a/src/corelib/tools/qlocale_tools.cpp b/src/corelib/tools/qlocale_tools.cpp index 31a29d7fe1..2d6b8047a6 100644 --- a/src/corelib/tools/qlocale_tools.cpp +++ b/src/corelib/tools/qlocale_tools.cpp @@ -601,7 +601,7 @@ QT_END_INCLUDE_NAMESPACE #error Exactly one of IEEE_BIG_OR_LITTLE_ENDIAN, VAX, or IBM should be defined. #endif -static inline ULong _getWord0(const NEEDS_VOLATILE double x) +static inline ULong getWord0(const NEEDS_VOLATILE double x) { const NEEDS_VOLATILE uchar *ptr = reinterpret_cast<const NEEDS_VOLATILE uchar *>(&x); if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { @@ -611,7 +611,7 @@ static inline ULong _getWord0(const NEEDS_VOLATILE double x) } } -static inline void _setWord0(NEEDS_VOLATILE double *x, ULong l) +static inline void setWord0(NEEDS_VOLATILE double *x, ULong l) { NEEDS_VOLATILE uchar *ptr = reinterpret_cast<NEEDS_VOLATILE uchar *>(x); if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { @@ -627,7 +627,7 @@ static inline void _setWord0(NEEDS_VOLATILE double *x, ULong l) } } -static inline ULong _getWord1(const NEEDS_VOLATILE double x) +static inline ULong getWord1(const NEEDS_VOLATILE double x) { const NEEDS_VOLATILE uchar *ptr = reinterpret_cast<const NEEDS_VOLATILE uchar *>(&x); if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { @@ -636,7 +636,7 @@ static inline ULong _getWord1(const NEEDS_VOLATILE double x) return (ptr[3]<<24) + (ptr[2]<<16) + (ptr[1]<<8) + ptr[0]; } } -static inline void _setWord1(NEEDS_VOLATILE double *x, ULong l) +static inline void setWord1(NEEDS_VOLATILE double *x, ULong l) { NEEDS_VOLATILE uchar *ptr = reinterpret_cast<uchar NEEDS_VOLATILE *>(x); if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { @@ -652,42 +652,6 @@ static inline void _setWord1(NEEDS_VOLATILE double *x, ULong l) } } -static inline ULong getWord0(const NEEDS_VOLATILE double x) -{ -#ifdef QT_ARMFPA - return _getWord1(x); -#else - return _getWord0(x); -#endif -} - -static inline void setWord0(NEEDS_VOLATILE double *x, ULong l) -{ -#ifdef QT_ARMFPA - _setWord1(x, l); -#else - _setWord0(x, l); -#endif -} - -static inline ULong getWord1(const NEEDS_VOLATILE double x) -{ -#ifdef QT_ARMFPA - return _getWord0(x); -#else - return _getWord1(x); -#endif -} - -static inline void setWord1(NEEDS_VOLATILE double *x, ULong l) -{ -#ifdef QT_ARMFPA - _setWord0(x, l); -#else - _setWord1(x, l); -#endif -} - static inline void Storeinc(ULong *&a, const ULong &b, const ULong &c) { diff --git a/src/corelib/tools/qlocale_tools_p.h b/src/corelib/tools/qlocale_tools_p.h index 2dc5c03a20..d920d41cb3 100644 --- a/src/corelib/tools/qlocale_tools_p.h +++ b/src/corelib/tools/qlocale_tools_p.h @@ -97,15 +97,11 @@ QString &exponentForm(QChar zero, QChar decimal, QChar exponential, inline bool isZero(double d) { uchar *ch = (uchar *)&d; -#ifdef QT_ARMFPA - return !(ch[3] & 0x7F || ch[2] || ch[1] || ch[0] || ch[7] || ch[6] || ch[5] || ch[4]); -#else if (QSysInfo::ByteOrder == QSysInfo::BigEndian) { return !(ch[0] & 0x7F || ch[1] || ch[2] || ch[3] || ch[4] || ch[5] || ch[6] || ch[7]); } else { return !(ch[7] & 0x7F || ch[6] || ch[5] || ch[4] || ch[3] || ch[2] || ch[1] || ch[0]); } -#endif } // Removes thousand-group separators in "C" locale. diff --git a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp index 02acb00548..b3b573c64b 100644 --- a/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp +++ b/tests/auto/corelib/tools/qlocale/tst_qlocale.cpp @@ -809,11 +809,7 @@ void tst_QLocale::negativeZero() { double negativeZero( 0.0 ); // Initialise to zero. uchar *ptr = (uchar *)&negativeZero; -#ifdef QT_ARMFPA - ptr[3] = 0x80; -#else ptr[QSysInfo::ByteOrder == QSysInfo::BigEndian ? 0 : 7] = 0x80; -#endif QString s = QString::number(negativeZero); QCOMPARE(s, QString("0")); } diff --git a/tests/auto/corelib/tools/qstring/tst_qstring.cpp b/tests/auto/corelib/tools/qstring/tst_qstring.cpp index 7e4f591f47..f007d44262 100644 --- a/tests/auto/corelib/tools/qstring/tst_qstring.cpp +++ b/tests/auto/corelib/tools/qstring/tst_qstring.cpp @@ -4147,16 +4147,7 @@ void tst_QString::tortureSprintfDouble() # error "Q_BYTE_ORDER not defined" # endif -# ifdef QT_ARMFPA - buff[0] = data->bytes[4]; - buff[1] = data->bytes[5]; - buff[2] = data->bytes[6]; - buff[3] = data->bytes[7]; - buff[4] = data->bytes[0]; - buff[5] = data->bytes[1]; - buff[6] = data->bytes[2]; - buff[7] = data->bytes[3]; -# elif Q_BYTE_ORDER == Q_LITTLE_ENDIAN +# if Q_BYTE_ORDER == Q_LITTLE_ENDIAN for (uint i = 0; i < 8; ++i) buff[i] = data->bytes[i]; # else diff --git a/tests/auto/other/compiler/tst_compiler.cpp b/tests/auto/other/compiler/tst_compiler.cpp index d72a04c8aa..1f461ba10b 100644 --- a/tests/auto/other/compiler/tst_compiler.cpp +++ b/tests/auto/other/compiler/tst_compiler.cpp @@ -525,33 +525,23 @@ void tst_Compiler::privateStaticTemplateMember() const // the second member of the union static const union { unsigned char c[8]; double d; } qt_be_inf_bytes = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } }; static const union { unsigned char c[8]; double d; } qt_le_inf_bytes = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } }; -static const union { unsigned char c[8]; double d; } qt_armfpa_inf_bytes = { { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 } }; static inline double qt_inf() { -#ifdef QT_ARMFPA - return qt_armfpa_inf_bytes.d; -#else return (QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_inf_bytes.d : qt_le_inf_bytes.d); -#endif } #else static const unsigned char qt_be_inf_bytes[] = { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }; static const unsigned char qt_le_inf_bytes[] = { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f }; -static const unsigned char qt_armfpa_inf_bytes[] = { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 }; static inline double qt_inf() { const uchar *bytes; -#ifdef QT_ARMFPA - bytes = qt_armfpa_inf_bytes; -#else bytes = (QSysInfo::ByteOrder == QSysInfo::BigEndian ? qt_be_inf_bytes : qt_le_inf_bytes); -#endif union { uchar c[8]; double d; } returnValue; memcpy(returnValue.c, bytes, sizeof(returnValue.c)); |