1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

Remove redundant operators !=

This commit is contained in:
Nekotekina 2021-04-29 20:53:07 +03:00
parent 98c0b3a2b1
commit f8e05f8e3c
13 changed files with 11 additions and 251 deletions

View File

@ -244,11 +244,6 @@ namespace utils
return (start == other.start && end == other.end); return (start == other.start && end == other.end);
} }
bool operator !=(const address_range &other) const
{
return (start != other.start || end != other.end);
}
/** /**
* Debug * Debug
*/ */

View File

@ -138,14 +138,9 @@ public:
return bs_t(0, lhs.m_data ^ rhs.m_data); return bs_t(0, lhs.m_data ^ rhs.m_data);
} }
friend constexpr bool operator ==(bs_t lhs, bs_t rhs) constexpr bool operator ==(bs_t rhs) const
{ {
return lhs.m_data == rhs.m_data; return m_data == rhs.m_data;
}
friend constexpr bool operator !=(bs_t lhs, bs_t rhs)
{
return lhs.m_data != rhs.m_data;
} }
constexpr bool test_and_set(T bit) constexpr bool test_and_set(T bit)

View File

@ -102,14 +102,6 @@ struct size2_base
return width == rhs.width && height == rhs.height; return width == rhs.width && height == rhs.height;
} }
#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator !=(const size2_base& rhs) const
{
return width != rhs.width || height != rhs.height;
}
#endif
template<typename NT> template<typename NT>
explicit constexpr operator size2_base<NT>() const explicit constexpr operator size2_base<NT>() const
{ {
@ -211,19 +203,6 @@ struct position1_base
return x == rhs; return x == rhs;
} }
#if __cpp_impl_three_way_comparison >= 201711
#else
bool operator !=(const position1_base& rhs) const
{
return !(*this == rhs);
}
bool operator !=(T rhs) const
{
return !(*this == rhs);
}
#endif
template<typename NT> template<typename NT>
explicit operator position1_base<NT>() const explicit operator position1_base<NT>() const
{ {
@ -383,19 +362,6 @@ struct position2_base
return x == rhs && y == rhs; return x == rhs && y == rhs;
} }
#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator !=(const position2_base& rhs) const
{
return !(*this == rhs);
}
constexpr bool operator !=(T rhs) const
{
return !(*this == rhs);
}
#endif
template<typename NT> template<typename NT>
explicit constexpr operator position2_base<NT>() const explicit constexpr operator position2_base<NT>() const
{ {
@ -478,19 +444,6 @@ struct position3_base
return x == rhs && y == rhs && z == rhs; return x == rhs && y == rhs && z == rhs;
} }
#if __cpp_impl_three_way_comparison >= 201711
#else
bool operator !=(const position3_base& rhs) const
{
return !(*this == rhs);
}
bool operator !=(T rhs) const
{
return !(*this == rhs);
}
#endif
template<typename NT> template<typename NT>
explicit operator position3_base<NT>() const explicit operator position3_base<NT>() const
{ {
@ -571,19 +524,6 @@ struct position4_base
return x == rhs && y == rhs && z == rhs && w == rhs; return x == rhs && y == rhs && z == rhs && w == rhs;
} }
#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator !=(const position4_base& rhs) const
{
return !(*this == rhs);
}
constexpr bool operator !=(T rhs) const
{
return !(*this == rhs);
}
#endif
template<typename NT> template<typename NT>
explicit constexpr operator position4_base<NT>() const explicit constexpr operator position4_base<NT>() const
{ {
@ -639,14 +579,6 @@ struct coord_base
return position == rhs.position && size == rhs.size; return position == rhs.position && size == rhs.size;
} }
#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator != (const coord_base& rhs) const
{
return position != rhs.position || size != rhs.size;
}
#endif
template<typename NT> template<typename NT>
explicit constexpr operator coord_base<NT>() const explicit constexpr operator coord_base<NT>() const
{ {
@ -718,14 +650,6 @@ struct area_base
return x1 == rhs.x1 && x2 == rhs.x2 && y1 == rhs.y1 && y2 == rhs.y2; return x1 == rhs.x1 && x2 == rhs.x2 && y1 == rhs.y1 && y2 == rhs.y2;
} }
#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator != (const area_base& rhs) const
{
return !(*this == rhs);
}
#endif
constexpr area_base operator - (const size2_base<T>& size) const constexpr area_base operator - (const size2_base<T>& size) const
{ {
return{ x1 - size.width, y1 - size.height, x2 - size.width, y2 - size.height }; return{ x1 - size.width, y1 - size.height, x2 - size.width, y2 - size.height };
@ -868,13 +792,6 @@ struct color4_base
{ {
return r == rhs.r && g == rhs.g && b == rhs.b && a == rhs.a; return r == rhs.r && g == rhs.g && b == rhs.b && a == rhs.a;
} }
#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator != (const color4_base& rhs) const
{
return !(*this == rhs);
}
#endif
void operator *= (const color4_base<T>& rhs) void operator *= (const color4_base<T>& rhs)
{ {
@ -944,13 +861,6 @@ struct color3_base
{ {
return r == rhs.r && g == rhs.g && b == rhs.b; return r == rhs.r && g == rhs.g && b == rhs.b;
} }
#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator != (const color3_base& rhs) const
{
return !(*this == rhs);
}
#endif
template<typename NT> template<typename NT>
explicit constexpr operator color3_base<NT>() const explicit constexpr operator color3_base<NT>() const
@ -989,14 +899,6 @@ struct color2_base
return r == rhs.r && g == rhs.g; return r == rhs.r && g == rhs.g;
} }
#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator != (const color2_base& rhs) const
{
return !(*this == rhs);
}
#endif
template<typename NT> template<typename NT>
explicit constexpr operator color2_base<NT>() const explicit constexpr operator color2_base<NT>() const
{ {
@ -1023,14 +925,6 @@ struct color1_base
return r == rhs.r; return r == rhs.r;
} }
#if __cpp_impl_three_way_comparison >= 201711
#else
constexpr bool operator != (const color1_base& rhs) const
{
return !(*this == rhs);
}
#endif
template<typename NT> template<typename NT>
explicit constexpr operator color1_base<NT>() const explicit constexpr operator color1_base<NT>() const
{ {

View File

@ -161,11 +161,6 @@ public:
return m_ptr == rhs.m_ptr; return m_ptr == rhs.m_ptr;
} }
bool operator !=(const lf_queue_iterator& rhs) const
{
return m_ptr != rhs.m_ptr;
}
T& operator *() const T& operator *() const
{ {
return m_ptr->m_data; return m_ptr->m_data;

View File

@ -51,11 +51,6 @@ struct spu_program
bool operator==(const spu_program& rhs) const noexcept; bool operator==(const spu_program& rhs) const noexcept;
bool operator!=(const spu_program& rhs) const noexcept
{
return !(*this == rhs);
}
bool operator<(const spu_program& rhs) const noexcept; bool operator<(const spu_program& rhs) const noexcept;
}; };

View File

@ -354,75 +354,15 @@ namespace vm
} }
template<typename T, typename AT> template<typename T, typename AT>
friend bool operator ==(const null_t&, const _ptr_base<T, AT>& ptr) constexpr bool operator ==(const _ptr_base<T, AT>& ptr) const
{ {
return !ptr; return !ptr;
} }
template<typename T, typename AT> template<typename T, typename AT>
friend bool operator ==(const _ptr_base<T, AT>& ptr, const null_t&) constexpr bool operator <(const _ptr_base<T, AT>& ptr) const
{ {
return !ptr; return 0 < ptr.addr();
}
template<typename T, typename AT>
friend bool operator !=(const null_t&, const _ptr_base<T, AT>& ptr)
{
return ptr.operator bool();
}
template<typename T, typename AT>
friend bool operator !=(const _ptr_base<T, AT>& ptr, const null_t&)
{
return ptr.operator bool();
}
template<typename T, typename AT>
friend bool operator <(const null_t&, const _ptr_base<T, AT>& ptr)
{
return ptr.operator bool();
}
template<typename T, typename AT>
friend bool operator <(const _ptr_base<T, AT>&, const null_t&)
{
return false;
}
template<typename T, typename AT>
friend bool operator <=(const null_t&, const _ptr_base<T, AT>&)
{
return true;
}
template<typename T, typename AT>
friend bool operator <=(const _ptr_base<T, AT>& ptr, const null_t&)
{
return !ptr.operator bool();
}
template<typename T, typename AT>
friend bool operator >(const null_t&, const _ptr_base<T, AT>&)
{
return false;
}
template<typename T, typename AT>
friend bool operator >(const _ptr_base<T, AT>& ptr, const null_t&)
{
return ptr.operator bool();
}
template<typename T, typename AT>
friend bool operator >=(const null_t&, const _ptr_base<T, AT>& ptr)
{
return !ptr;
}
template<typename T, typename AT>
friend bool operator >=(const _ptr_base<T, AT>&, const null_t&)
{
return true;
} }
}; };
@ -436,12 +376,6 @@ inline vm::if_comparable_t<T1, T2, bool> operator ==(const vm::_ptr_base<T1, AT1
return left.addr() == right.addr(); return left.addr() == right.addr();
} }
template<typename T1, typename AT1, typename T2, typename AT2>
inline vm::if_comparable_t<T1, T2, bool> operator !=(const vm::_ptr_base<T1, AT1>& left, const vm::_ptr_base<T2, AT2>& right)
{
return left.addr() != right.addr();
}
template<typename T1, typename AT1, typename T2, typename AT2> template<typename T1, typename AT1, typename T2, typename AT2>
inline vm::if_comparable_t<T1, T2, bool> operator <(const vm::_ptr_base<T1, AT1>& left, const vm::_ptr_base<T2, AT2>& right) inline vm::if_comparable_t<T1, T2, bool> operator <(const vm::_ptr_base<T1, AT1>& left, const vm::_ptr_base<T2, AT2>& right)
{ {

View File

@ -101,11 +101,6 @@ namespace rsx
{ {
return cpu_range == other.cpu_range && format == other.format && context == other.context; return cpu_range == other.cpu_range && format == other.format && context == other.context;
} }
bool operator!=(const texture_cache_predictor_key& other) const
{
return !operator==(other);
}
}; };
/** /**

View File

@ -106,7 +106,6 @@ namespace rsx
inline reference operator++() { next(); return **this; } inline reference operator++() { next(); return **this; }
inline reference operator++(int) { auto &res = **this; next(); return res; } inline reference operator++(int) { auto &res = **this; next(); return res; }
inline bool operator==(const iterator_tmpl &rhs) const { return idx == rhs.idx; } inline bool operator==(const iterator_tmpl &rhs) const { return idx == rhs.idx; }
inline bool operator!=(const iterator_tmpl &rhs) const { return idx != rhs.idx; }
}; };
using iterator = iterator_tmpl<value_type, ranged_storage_block_list, typename list_type::iterator>; using iterator = iterator_tmpl<value_type, ranged_storage_block_list, typename list_type::iterator>;
@ -819,7 +818,6 @@ namespace rsx
inline reference operator++() { next(); return *obj; } inline reference operator++() { next(); return *obj; }
inline reference operator++(int) { auto *ptr = obj; next(); return *ptr; } inline reference operator++(int) { auto *ptr = obj; next(); return *ptr; }
inline bool operator==(const range_iterator_tmpl &rhs) const { return obj == rhs.obj && unowned_remaining == rhs.unowned_remaining; } inline bool operator==(const range_iterator_tmpl &rhs) const { return obj == rhs.obj && unowned_remaining == rhs.unowned_remaining; }
inline bool operator!=(const range_iterator_tmpl &rhs) const { return !operator==(rhs); }
inline void set_end(u32 new_end) inline void set_end(u32 new_end)
{ {

View File

@ -68,8 +68,7 @@ namespace rsx
surface_depth_format to_surface_depth_format(u8 in); surface_depth_format to_surface_depth_format(u8 in);
constexpr constexpr bool operator ==(surface_depth_format2 rhs, surface_depth_format lhs)
bool operator == (surface_depth_format2 rhs, surface_depth_format lhs)
{ {
switch (lhs) switch (lhs)
{ {
@ -82,25 +81,6 @@ namespace rsx
} }
} }
// GCC requires every operator declared explicitly
constexpr
bool operator == (surface_depth_format rhs, surface_depth_format2 lhs)
{
return lhs == rhs;
}
constexpr
bool operator != (surface_depth_format2 rhs, surface_depth_format lhs)
{
return !(rhs == lhs);
}
constexpr
bool operator != (surface_depth_format rhs, surface_depth_format2 lhs)
{
return !(lhs == rhs);
}
enum class surface_raster_type : u8 enum class surface_raster_type : u8
{ {
undefined = 0, undefined = 0,

View File

@ -285,15 +285,6 @@ public:
return value() == rhs; return value() == rhs;
} }
#if __cpp_impl_three_way_comparison >= 201711
#else
template <typename T2, typename = decltype(+std::declval<const T2&>())>
constexpr bool operator!=(const T2& rhs) const noexcept
{
return !operator==<T2>(rhs);
}
#endif
private: private:
template <typename T2> template <typename T2>
static constexpr bool check_args_for_bitwise_op() static constexpr bool check_args_for_bitwise_op()

View File

@ -140,11 +140,6 @@ namespace stx
{ {
return ptr == r.ptr; return ptr == r.ptr;
} }
bool operator!=(const const_iterator& r) const
{
return ptr != r.ptr;
}
}; };
const_iterator begin() const const_iterator begin() const

View File

@ -207,8 +207,6 @@ union alignas(16) v128
bool operator==(const v128& right) const; bool operator==(const v128& right) const;
bool operator!=(const v128& right) const;
// result = (~left) & (right) // result = (~left) & (right)
static inline v128 andnot(const v128& left, const v128& right); static inline v128 andnot(const v128& left, const v128& right);

View File

@ -151,11 +151,6 @@ inline bool v128::operator==(const v128& right) const
return _mm_movemask_epi8(v128::eq32(*this, right).vi) == 0xffff; return _mm_movemask_epi8(v128::eq32(*this, right).vi) == 0xffff;
} }
inline bool v128::operator!=(const v128& right) const
{
return !operator==(right);
}
// result = (~left) & (right) // result = (~left) & (right)
inline v128 v128::andnot(const v128& left, const v128& right) inline v128 v128::andnot(const v128& left, const v128& right)
{ {