From 46d3c25980cac2592c4ad07a927f1f9a4a9e0f53 Mon Sep 17 00:00:00 2001 From: Marc Mutz Date: Wed, 28 Jan 2015 09:51:18 +0100 Subject: Partially revert "QFixed: fix undefined behavior" This partially reverts commit 1755038134cfe16d3d52ec2aea543955462e2951, which did not only fix undefined (signed left-shift), but also implementation-defined (signed right-shift) behavior. It turned out that code depends on a particular implementation behavior (logical instead of arithmetic right-shift), and needs to be fixed first. Change-Id: I9ba32d06f127d17d05e0c6f6eac3d26268587bca Reviewed-by: Olivier Goffart (Woboq GmbH) Reviewed-by: Eike Ziller --- src/gui/painting/qfixed_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src') diff --git a/src/gui/painting/qfixed_p.h b/src/gui/painting/qfixed_p.h index a0ac69f02f..68314d0434 100644 --- a/src/gui/painting/qfixed_p.h +++ b/src/gui/painting/qfixed_p.h @@ -70,7 +70,7 @@ public: Q_DECL_CONSTEXPR inline int toInt() const { return (((val)+32) & -64)>>6; } Q_DECL_CONSTEXPR inline qreal toReal() const { return ((qreal)val)/(qreal)64; } - Q_DECL_CONSTEXPR inline int truncate() const { return val / 64; } + Q_DECL_CONSTEXPR inline int truncate() const { return val>>6; } Q_DECL_CONSTEXPR inline QFixed round() const { return fromFixed(((val)+32) & -64); } Q_DECL_CONSTEXPR inline QFixed floor() const { return fromFixed((val) & -64); } Q_DECL_CONSTEXPR inline QFixed ceil() const { return fromFixed((val+63) & -64); } -- cgit v1.2.3