forked from Mirrors/openclonk
Add some missing operators to C4Real.h
parent
c5ff06547b
commit
bd2a4b0059
|
@ -149,6 +149,7 @@ public:
|
|||
|
||||
// Conversion
|
||||
inline operator int() const { return _mm_cvtss_si32(value); }
|
||||
inline operator long() const { return this->operator int(); }
|
||||
inline operator float() const { float nrv; _mm_store_ss(&nrv, value); return nrv; }
|
||||
|
||||
// Boolean operators
|
||||
|
@ -204,4 +205,16 @@ C4Real Sqrt(const C4Real &);
|
|||
C4Real Log(const C4Real &);
|
||||
C4Real Atan2(const C4Real &y, const C4Real &x);
|
||||
|
||||
// Ambiguity resolving
|
||||
#define C4REAL_RHAND_OP(op) \
|
||||
inline float & operator op(float & lhs, const C4Real & rhs) { return lhs+=fixtoi(rhs); } \
|
||||
inline int32_t & operator op(int32_t & lhs, const C4Real & rhs) { return lhs+=fixtoi(rhs); } \
|
||||
inline long & operator op(long & lhs, const C4Real & rhs) { return lhs+=fixtoi(rhs); }
|
||||
C4REAL_RHAND_OP(+=)
|
||||
C4REAL_RHAND_OP(-=)
|
||||
C4REAL_RHAND_OP(*=)
|
||||
C4REAL_RHAND_OP(/=)
|
||||
C4REAL_RHAND_OP(%=)
|
||||
#undef C4REAL_RHAND_OP
|
||||
|
||||
#endif //C4REAL_H_INC
|
||||
|
|
Loading…
Reference in New Issue