Partially revert "QFixed: fix undefined behavior"
This partially reverts commit 1755038134
,
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>
This commit is contained in:
parent
a776e4cf78
commit
46d3c25980
@ -70,7 +70,7 @@ public:
|
|||||||
Q_DECL_CONSTEXPR inline int toInt() const { return (((val)+32) & -64)>>6; }
|
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 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 round() const { return fromFixed(((val)+32) & -64); }
|
||||||
Q_DECL_CONSTEXPR inline QFixed floor() const { return fromFixed((val) & -64); }
|
Q_DECL_CONSTEXPR inline QFixed floor() const { return fromFixed((val) & -64); }
|
||||||
Q_DECL_CONSTEXPR inline QFixed ceil() const { return fromFixed((val+63) & -64); }
|
Q_DECL_CONSTEXPR inline QFixed ceil() const { return fromFixed((val+63) & -64); }
|
||||||
|
Loading…
Reference in New Issue
Block a user