7#ifndef __KIS_FIXED_POINT_MATHS_H
8#define __KIS_FIXED_POINT_MATHS_H
10#include <boost/operators.hpp>
25 :
d(static_cast<int>(fValue * 256))
30 return d >= 0 ?
d >> 8 : -((-
d) >> 8);
34 return d >= 0 ? (
d + (1 << 7)) >> 8 : -((-
d + (1 << 7)) >> 8);
38 return d >= 0 ? (
d + ((1 << 8) - 1)) >> 8 : -((-
d) >> 8);
42 return d >= 0 ?
d >> 8 : -((-
d + ((1 << 8) - 1)) >> 8);
46 return qreal(
d) / qreal(1 << 8);
69 return !(
d & ((1 << 8) -1 ));
130 dbg.nospace() <<
v.toFloat() <<
" (d = " <<
v.d <<
")";
KisFixedPoint & operator*=(const KisFixedPoint &x)
qint32 toIntRound() const
qint32 toIntFloor() const
friend QDebug operator<<(QDebug dbg, const KisFixedPoint &v)
friend KisFixedPoint operator-(KisFixedPoint x)
KisFixedPoint & operator+=(const KisFixedPoint &x)
KisFixedPoint & dec256Frac()
KisFixedPoint(int iValue)
KisFixedPoint & from256Frac(qint32 v)
bool operator<(const KisFixedPoint &x) const
KisFixedPoint & operator/=(const KisFixedPoint &x)
KisFixedPoint(qreal fValue)
KisFixedPoint & operator-=(const KisFixedPoint &x)
bool operator==(const KisFixedPoint &x) const
KisFixedPoint & inc256Frac()
QDebug operator<<(QDebug dbg, const KisFixedPoint &v)
KisFixedPoint operator-(KisFixedPoint x)