summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/corelib/global/qnumeric_p.h42
-rw-r--r--src/corelib/io/qdatastream.cpp69
-rw-r--r--src/corelib/tools/qlocale_tools.cpp44
-rw-r--r--src/corelib/tools/qlocale_tools_p.h4
4 files changed, 4 insertions, 155 deletions
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.