summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@kdab.com>2015-01-28 09:51:18 +0100
committerMarc Mutz <marc.mutz@kdab.com>2015-02-02 16:43:16 +0000
commit46d3c25980cac2592c4ad07a927f1f9a4a9e0f53 (patch)
tree243a15d03ef5235f8c5eab627e4c7af27a166abf
parenta776e4cf78d55ccd2d05911b2b466148edeb8015 (diff)
downloadqtbase-46d3c25980cac2592c4ad07a927f1f9a4a9e0f53.tar.gz
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) <ogoffart@woboq.com> Reviewed-by: Eike Ziller <eike.ziller@theqtcompany.com>
-rw-r--r--src/gui/painting/qfixed_p.h2
1 files changed, 1 insertions, 1 deletions
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); }