summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qdatastream.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2017-01-31 13:16:06 -0800
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2017-02-01 10:32:35 +0000
commit3ac806b76da4f841bc168201eb314e00d4a85df1 (patch)
tree3d6e590d0af2cd430b8be634772fc2d7780523dd /src/corelib/io/qdatastream.cpp
parentbc232b2befd6add9b275f868302b0f4b005a22a4 (diff)
De-inline qfloat16 streaming operators in QDataStream
Which allows us to remove the #include. The qfloat16 operator overloads in the global namespace are giving some trouble on some compilers, for reasons unknown (could be compiler bug, could be real). So don't #include the header anywhere else: let the user choose it. Task-number: QTBUG-58555 Change-Id: I4c9f691516694b90b08ffffd149ef7dff27d0f6a Reviewed-by: Jani Heikkinen <jani.heikkinen@qt.io>
Diffstat (limited to 'src/corelib/io/qdatastream.cpp')
-rw-r--r--src/corelib/io/qdatastream.cpp11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/corelib/io/qdatastream.cpp b/src/corelib/io/qdatastream.cpp
index cac5152e87..2369fe4726 100644
--- a/src/corelib/io/qdatastream.cpp
+++ b/src/corelib/io/qdatastream.cpp
@@ -42,6 +42,7 @@
#if !defined(QT_NO_DATASTREAM) || defined(QT_BOOTSTRAPPED)
#include "qbuffer.h"
+#include "qfloat16.h"
#include "qstring.h"
#include <stdio.h>
#include <ctype.h>
@@ -975,7 +976,6 @@ QDataStream &QDataStream::operator>>(double &f)
/*!
- \fn QDataStream &QDataStream::operator>>(qfloat16 &f)
\overload
\since 5.9
@@ -983,6 +983,11 @@ QDataStream &QDataStream::operator>>(double &f)
using the standard IEEE 754 format. Returns a reference to the
stream.
*/
+QDataStream &QDataStream::operator>>(qfloat16 &f)
+{
+ return *this >> reinterpret_cast<qint16&>(f);
+}
+
/*!
\overload
@@ -1280,6 +1285,10 @@ QDataStream &QDataStream::operator<<(double f)
Writes a floating point number, \a f, to the stream using
the standard IEEE 754 format. Returns a reference to the stream.
*/
+QDataStream &QDataStream::operator<<(qfloat16 f)
+{
+ return *this << reinterpret_cast<qint16&>(f);
+}
/*!
\overload