diff options
Diffstat (limited to 'src/corelib/global')
-rw-r--r-- | src/corelib/global/qendian.h | 18 | ||||
-rw-r--r-- | src/corelib/global/qglobal.h | 4 |
2 files changed, 11 insertions, 11 deletions
diff --git a/src/corelib/global/qendian.h b/src/corelib/global/qendian.h index 3c804ce..5d9141f 100644 --- a/src/corelib/global/qendian.h +++ b/src/corelib/global/qendian.h @@ -149,9 +149,9 @@ template <> inline quint32 qFromLittleEndian<quint32>(const uchar *src) template <> inline quint16 qFromLittleEndian<quint16>(const uchar *src) { - return 0 - | src[0] - | src[1] * 0x0100; + return quint16(0 + | src[0] + | src[1] * 0x0100); } // signed specializations @@ -241,9 +241,9 @@ inline quint32 qFromBigEndian<quint32>(const uchar *src) template<> inline quint16 qFromBigEndian<quint16>(const uchar *src) { - return 0 - | src[1] - | src[0] * quint16(0x0100); + return quint16( 0 + | src[1] + | src[0] * quint16(0x0100)); } @@ -288,9 +288,9 @@ template <> inline quint32 qbswap<quint32>(quint32 source) template <> inline quint16 qbswap<quint16>(quint16 source) { - return 0 - | ((source & 0x00ff) << 8) - | ((source & 0xff00) >> 8); + return quint16( 0 + | ((source & 0x00ff) << 8) + | ((source & 0xff00) >> 8) ); } // signed specializations diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h index b97b9d1..897dcea 100644 --- a/src/corelib/global/qglobal.h +++ b/src/corelib/global/qglobal.h @@ -1081,10 +1081,10 @@ inline int qRound(qreal d) #if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN) inline qint64 qRound64(double d) -{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qint64(d-1) + 0.5) + qint64(d-1); } +{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); } #else inline qint64 qRound64(qreal d) -{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qint64(d-1) + 0.5) + qint64(d-1); } +{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); } #endif template <typename T> |