summaryrefslogtreecommitdiffstats
path: root/src/corelib/global/qglobal.h
diff options
context:
space:
mode:
authorSamuel Rødal <samuel.rodal@nokia.com>2011-07-21 14:42:46 +0200
committerSamuel Rødal <samuel.rodal@nokia.com>2011-07-21 14:42:46 +0200
commit7b3b6b5afaaf1db1bfbfa9b56fa7b955a61344bd (patch)
tree8be0d601853d021434e03cef9a9cfd64b3708e92 /src/corelib/global/qglobal.h
parent070fc2f694beaa56fc191f1a3f6a1b9812f4ed35 (diff)
parent56defa4725508608a85e2813b85af3a7fcefefa0 (diff)
Merge remote branch 'gerrit/master' into refactor
Conflicts: examples/opengl/cube/main.cpp examples/widgets/applicationicon/main.cpp examples/widgets/orientation/main.cpp src/gui/image/qicon.cpp src/gui/image/qimage.h src/gui/image/qpixmap.h src/gui/image/qpixmap_mac.cpp src/gui/kernel/qapplication.cpp src/gui/kernel/qpalette.cpp src/gui/kernel/qwidget.cpp src/gui/styles/qmacstyle_mac.mm src/gui/widgets/qmenubar.cpp src/gui/widgets/qslider.cpp src/opengl/qwindowsurface_gl.cpp tests/auto/qvariant/qvariant.pro tests/benchmarks/corelib/kernel/qobject/qobject.pro tests/benchmarks/gui/animation/qanimation/qanimation.pro tests/benchmarks/gui/graphicsview/qgraphicsanchorlayout/qgraphicsanchorlayout.pro tests/benchmarks/gui/graphicsview/qgraphicsitem/qgraphicsitem.pro tests/benchmarks/gui/graphicsview/qgraphicsscene/qgraphicsscene.pro tests/benchmarks/gui/graphicsview/qgraphicsview/qgraphicsview.pro tests/benchmarks/gui/graphicsview/qgraphicswidget/qgraphicswidget.pro tests/benchmarks/gui/image/qimagereader/qimagereader.pro tests/benchmarks/gui/itemviews/qtableview/qtableview.pro tests/benchmarks/gui/kernel/qapplication/qapplication.pro tests/benchmarks/gui/kernel/qwidget/qwidget.pro tests/benchmarks/gui/painting/qpainter/qpainter.pro tests/benchmarks/gui/painting/qtbench/qtbench.pro tests/benchmarks/gui/painting/qtracebench/qtracebench.pro tests/benchmarks/gui/text/qtext/qtext.pro Change-Id: I4b911c795ecb29d73b6a7fd18819711b49478a30
Diffstat (limited to 'src/corelib/global/qglobal.h')
-rw-r--r--src/corelib/global/qglobal.h15
1 files changed, 7 insertions, 8 deletions
diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index 4960d2a245..e4084ed91f 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -1158,16 +1158,15 @@ typedef double qreal;
template <typename T>
Q_DECL_CONSTEXPR inline T qAbs(const T &t) { return t >= 0 ? t : -t; }
-Q_DECL_CONSTEXPR inline int qRound(qreal d)
-{ return d >= qreal(0.0) ? int(d + qreal(0.5)) : int(d - int(d-1) + qreal(0.5)) + int(d-1); }
+Q_DECL_CONSTEXPR inline int qRound(double d)
+{ return d >= 0.0 ? int(d + 0.5) : int(d - int(d-1) + 0.5) + int(d-1); }
+Q_DECL_CONSTEXPR inline int qRound(float d)
+{ return d >= 0.0f ? int(d + 0.5f) : int(d - int(d-1) + 0.5f) + int(d-1); }
-#if defined(QT_NO_FPU) || defined(QT_ARCH_ARM) || defined(QT_ARCH_WINDOWSCE) || defined(QT_ARCH_SYMBIAN)
Q_DECL_CONSTEXPR inline qint64 qRound64(double d)
-{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - qreal(qint64(d-1)) + 0.5) + qint64(d-1); }
-#else
-Q_DECL_CONSTEXPR inline qint64 qRound64(qreal d)
-{ return d >= qreal(0.0) ? qint64(d + qreal(0.5)) : qint64(d - qreal(qint64(d-1)) + qreal(0.5)) + qint64(d-1); }
-#endif
+{ return d >= 0.0 ? qint64(d + 0.5) : qint64(d - double(qint64(d-1)) + 0.5) + qint64(d-1); }
+Q_DECL_CONSTEXPR inline qint64 qRound64(float d)
+{ return d >= 0.0f ? qint64(d + 0.5f) : qint64(d - float(qint64(d-1)) + 0.5f) + qint64(d-1); }
template <typename T>
Q_DECL_CONSTEXPR inline const T &qMin(const T &a, const T &b) { return (a < b) ? a : b; }