aboutsummaryrefslogtreecommitdiffstats
path: root/al
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2022-02-20 04:13:03 -0800
committerChris Robinson <[email protected]>2022-02-20 04:13:03 -0800
commit023ad6320be73d1cee3facad1722e94d7258f2bb (patch)
tree1bf32b6d4a3e26ac821c47935c5b36f01eeee601 /al
parent0e26e0809d1aaa8501f310982b554565dc9e8beb (diff)
Inline a couple more equality operators
Diffstat (limited to 'al')
-rw-r--r--al/eax_api.cpp15
-rw-r--r--al/eax_api.h10
-rw-r--r--al/eax_fx_slot_index.cpp19
-rw-r--r--al/eax_fx_slot_index.h19
4 files changed, 15 insertions, 48 deletions
diff --git a/al/eax_api.cpp b/al/eax_api.cpp
index 391363ec..bc778f03 100644
--- a/al/eax_api.cpp
+++ b/al/eax_api.cpp
@@ -254,21 +254,6 @@ const GUID EAX_RINGMODULATOR_EFFECT =
bool operator==(
- const EAXVECTOR& lhs,
- const EAXVECTOR& rhs) noexcept
-{
- return lhs.x == rhs.x && lhs.y == rhs.y && lhs.z == rhs.z;
-}
-
-bool operator!=(
- const EAXVECTOR& lhs,
- const EAXVECTOR& rhs) noexcept
-{
- return !(lhs == rhs);
-}
-
-
-bool operator==(
const EAX40CONTEXTPROPERTIES& lhs,
const EAX40CONTEXTPROPERTIES& rhs) noexcept
{
diff --git a/al/eax_api.h b/al/eax_api.h
index c5004ec6..28e8881e 100644
--- a/al/eax_api.h
+++ b/al/eax_api.h
@@ -157,13 +157,11 @@ struct EAXVECTOR
float z;
}; // EAXVECTOR
-bool operator==(
- const EAXVECTOR& lhs,
- const EAXVECTOR& rhs) noexcept;
+inline bool operator==(const EAXVECTOR& lhs, const EAXVECTOR& rhs) noexcept
+{ return std::memcmp(&lhs, &rhs, sizeof(EAXVECTOR)) == 0; }
-bool operator!=(
- const EAXVECTOR& lhs,
- const EAXVECTOR& rhs) noexcept;
+inline bool operator!=(const EAXVECTOR& lhs, const EAXVECTOR& rhs) noexcept
+{ return !(lhs == rhs); }
extern const GUID EAXPROPERTYID_EAX40_Context;
diff --git a/al/eax_fx_slot_index.cpp b/al/eax_fx_slot_index.cpp
index fe74097d..9aa695ad 100644
--- a/al/eax_fx_slot_index.cpp
+++ b/al/eax_fx_slot_index.cpp
@@ -69,22 +69,3 @@ void EaxFxSlotIndex::fail(const char* message)
{
throw EaxFxSlotIndexException{message};
}
-
-
-bool operator==(
- const EaxFxSlotIndex& lhs,
- const EaxFxSlotIndex& rhs) noexcept
-{
- if(lhs.has_value() != rhs.has_value())
- return false;
- if(lhs.has_value())
- return *lhs == *rhs;
- return true;
-}
-
-bool operator!=(
- const EaxFxSlotIndex& lhs,
- const EaxFxSlotIndex& rhs) noexcept
-{
- return !(lhs == rhs);
-}
diff --git a/al/eax_fx_slot_index.h b/al/eax_fx_slot_index.h
index 2913ee8d..e1e5475a 100644
--- a/al/eax_fx_slot_index.h
+++ b/al/eax_fx_slot_index.h
@@ -10,7 +10,6 @@
using EaxFxSlotIndexValue = std::size_t;
-
class EaxFxSlotIndex : public al::optional<EaxFxSlotIndexValue>
{
public:
@@ -27,12 +26,16 @@ private:
static void fail(const char *message);
}; // EaxFxSlotIndex
-bool operator==(
- const EaxFxSlotIndex& lhs,
- const EaxFxSlotIndex& rhs) noexcept;
-
-bool operator!=(
- const EaxFxSlotIndex& lhs,
- const EaxFxSlotIndex& rhs) noexcept;
+inline bool operator==(const EaxFxSlotIndex& lhs, const EaxFxSlotIndex& rhs) noexcept
+{
+ if(lhs.has_value() != rhs.has_value())
+ return false;
+ if(lhs.has_value())
+ return *lhs == *rhs;
+ return true;
+}
+
+inline bool operator!=(const EaxFxSlotIndex& lhs, const EaxFxSlotIndex& rhs) noexcept
+{ return !(lhs == rhs); }
#endif // !EAX_FX_SLOT_INDEX_INCLUDED