Clarify expected operator ordering

This commit is contained in:
Alex Harker
2019-06-15 12:51:33 +01:00
parent 0c87136401
commit 0f7a7a84c7
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -288,7 +288,7 @@ FL_FP::FL_FP(const FL_SP& val) : mInt(val.intVal()), mFrac(val.fracHiVal())
{
// Complete rounding
if (checkHighBit(val.fracLoVal()) & !(mInt == std::numeric_limits<uint64_t>::max() & mFrac == std::numeric_limits<uint64_t>::max()))
if (checkHighBit(val.fracLoVal()) & !((mInt == std::numeric_limits<uint64_t>::max()) & (mFrac == std::numeric_limits<uint64_t>::max())))
*this += FL_FP(0, 1);
}
+3 -3
View File
@@ -82,11 +82,11 @@ public:
// Comparison operators (N.B. - it is faster to avoid branching using bit rather logical operators)
friend bool operator == (const FL_FP& a, const FL_FP& b) { return (a.mInt == b.mInt & a.mFrac == b.mFrac); }
friend bool operator == (const FL_FP& a, const FL_FP& b) { return ((a.mInt == b.mInt) & (a.mFrac == b.mFrac)); }
friend bool operator != (const FL_FP& a, const FL_FP& b) { return !(a == b); }
friend bool operator < (const FL_FP& a, const FL_FP& b) { return ((a.mInt < b.mInt) | (a.mInt == b.mInt & a.mFrac < b.mFrac)); }
friend bool operator > (const FL_FP& a, const FL_FP& b) { return ((a.mInt > b.mInt) | (a.mInt == b.mInt & a.mFrac > b.mFrac)); }
friend bool operator < (const FL_FP& a, const FL_FP& b) { return ((a.mInt < b.mInt) | ((a.mInt == b.mInt) & (a.mFrac < b.mFrac))); }
friend bool operator > (const FL_FP& a, const FL_FP& b) { return ((a.mInt > b.mInt) | ((a.mInt == b.mInt) & (a.mFrac > b.mFrac))); }
friend bool operator <= (const FL_FP& a, const FL_FP& b) { return !(a > b); }
friend bool operator >= (const FL_FP& a, const FL_FP& b) { return !(a < b); }