QFixed: remove user-defined assignment operators
They don't give us anything: For every op=(X), there's an implicit QFixed(X) constructor that will resolve any fix = x; as fix = QFixed(x); with no performance penalty. Change-Id: Ia5b0364617a646f3cf122b47363d6099548bb5c2 Reviewed-by: Lars Knoll <lars.knoll@gmail.com> (cherry picked from commit 9b92f599406aaf218fd2be2f290dc4938049ade1) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
parent
9222bc35da
commit
530fbd2faa
@ -29,8 +29,6 @@ public:
|
||||
constexpr QFixed() : val(0) {}
|
||||
constexpr QFixed(int i) : val(i * 64) {}
|
||||
constexpr QFixed(long i) : val(i * 64) {}
|
||||
QFixed &operator=(int i) { val = i * 64; return *this; }
|
||||
QFixed &operator=(long i) { val = i * 64; return *this; }
|
||||
|
||||
constexpr static QFixed fromReal(qreal r) { return fromFixed((int)(r*qreal(64))); }
|
||||
constexpr static QFixed fromFixed(int fixed) { return QFixed(fixed,0); } // uses private ctor
|
||||
@ -107,7 +105,6 @@ public:
|
||||
|
||||
private:
|
||||
constexpr QFixed(qreal i) : val((int)(i*qreal(64))) {}
|
||||
QFixed &operator=(qreal i) { val = (int)(i*qreal(64)); return *this; }
|
||||
constexpr inline QFixed operator+(qreal i) const { return fromFixed((val + (int)(i*qreal(64)))); }
|
||||
inline QFixed &operator+=(qreal i) { val += (int)(i*64); return *this; }
|
||||
constexpr inline QFixed operator-(qreal i) const { return fromFixed((val - (int)(i*qreal(64)))); }
|
||||
|
Loading…
x
Reference in New Issue
Block a user