diff --git a/Common/Swap.h b/Common/Swap.h index 0f81528719..e693a22dd9 100644 --- a/Common/Swap.h +++ b/Common/Swap.h @@ -115,7 +115,6 @@ protected: public: T const swap() const { return swap(value); - } swap_struct_t() : value((T)0) {} swap_struct_t(const T &v): value(swap(v)) {} @@ -377,126 +376,126 @@ public: // Arithmetics template - friend S operator+(const S &p, const swapped_t v); + friend S operator+(const S &p, const swapped_t& v); template - friend S operator-(const S &p, const swapped_t v); + friend S operator-(const S &p, const swapped_t& v); template - friend S operator/(const S &p, const swapped_t v); + friend S operator/(const S &p, const swapped_t& v); template - friend S operator*(const S &p, const swapped_t v); + friend S operator*(const S &p, const swapped_t& v); template - friend S operator%(const S &p, const swapped_t v); + friend S operator%(const S &p, const swapped_t& v); // Arithmetics + assignements template - friend S operator+=(const S &p, const swapped_t v); + friend S operator+=(const S &p, const swapped_t& v); template - friend S operator-=(const S &p, const swapped_t v); + friend S operator-=(const S &p, const swapped_t& v); // Bitmath template - friend S operator&(const S &p, const swapped_t v); + friend S operator&(const S &p, const swapped_t& v); // Comparison template - friend bool operator<(const S &p, const swapped_t v); + friend bool operator<(const S &p, const swapped_t& v); template - friend bool operator>(const S &p, const swapped_t v); + friend bool operator>(const S &p, const swapped_t& v); template - friend bool operator<=(const S &p, const swapped_t v); + friend bool operator<=(const S &p, const swapped_t& v); template - friend bool operator>=(const S &p, const swapped_t v); + friend bool operator>=(const S &p, const swapped_t& v); template - friend bool operator!=(const S &p, const swapped_t v); + friend bool operator!=(const S &p, const swapped_t& v); template - friend bool operator==(const S &p, const swapped_t v); + friend bool operator==(const S &p, const swapped_t& v); }; // Arithmetics template -S operator+(const S &i, const swap_struct_t v) { +S operator+(const S &i, const swap_struct_t& v) { return i + v.swap(); } template -S operator-(const S &i, const swap_struct_t v) { +S operator-(const S &i, const swap_struct_t& v) { return i - v.swap(); } template -S operator/(const S &i, const swap_struct_t v) { +S operator/(const S &i, const swap_struct_t& v) { return i / v.swap(); } template -S operator*(const S &i, const swap_struct_t v) { +S operator*(const S &i, const swap_struct_t& v) { return i * v.swap(); } template -S operator%(const S &i, const swap_struct_t v) { +S operator%(const S &i, const swap_struct_t& v) { return i % v.swap(); } // Arithmetics + assignements template -S &operator+=(S &i, const swap_struct_t v) { +S &operator+=(S &i, const swap_struct_t& v) { i += v.swap(); return i; } template -S &operator-=(S &i, const swap_struct_t v) { +S &operator-=(S &i, const swap_struct_t& v) { i -= v.swap(); return i; } // Logical template -S operator&(const S &i, const swap_struct_t v) { +S operator&(const S &i, const swap_struct_t& v) { return i & v.swap(); } template -S operator&(const swap_struct_t v, const S &i) { +S operator&(const swap_struct_t& v, const S &i) { return (S)(v.swap() & i); } // Comparaison template -bool operator<(const S &p, const swap_struct_t v) { +bool operator<(const S &p, const swap_struct_t& v) { return p < v.swap(); } template -bool operator>(const S &p, const swap_struct_t v) { +bool operator>(const S &p, const swap_struct_t& v) { return p > v.swap(); } template -bool operator<=(const S &p, const swap_struct_t v) { +bool operator<=(const S &p, const swap_struct_t& v) { return p <= v.swap(); } template -bool operator>=(const S &p, const swap_struct_t v) { +bool operator>=(const S &p, const swap_struct_t& v) { return p >= v.swap(); } template -bool operator!=(const S &p, const swap_struct_t v) { +bool operator!=(const S &p, const swap_struct_t& v) { return p != v.swap(); } template -bool operator==(const S &p, const swap_struct_t v) { +bool operator==(const S &p, const swap_struct_t& v) { return p == v.swap(); }