|
@@ -19,15 +19,18 @@ struct alignas(uint64) BodyPair
|
|
|
BodyPair(BodyID inA, BodyID inB) : mBodyA(inA), mBodyB(inB) { }
|
|
|
|
|
|
/// Equals operator
|
|
|
- bool operator == (const BodyPair &inRHS) const { static_assert(sizeof(*this) == sizeof(uint64), "Mismatch in class size"); return *reinterpret_cast<const uint64 *>(this) == *reinterpret_cast<const uint64 *>(&inRHS); }
|
|
|
+ bool operator == (const BodyPair &inRHS) const { return *reinterpret_cast<const uint64 *>(this) == *reinterpret_cast<const uint64 *>(&inRHS); }
|
|
|
|
|
|
/// Smaller than operator, used for consistently ordering body pairs
|
|
|
- bool operator < (const BodyPair &inRHS) const { static_assert(sizeof(*this) == sizeof(uint64), "Mismatch in class size"); return *reinterpret_cast<const uint64 *>(this) < *reinterpret_cast<const uint64 *>(&inRHS); }
|
|
|
+ bool operator < (const BodyPair &inRHS) const { return *reinterpret_cast<const uint64 *>(this) < *reinterpret_cast<const uint64 *>(&inRHS); }
|
|
|
|
|
|
- uint64 GetHash() const { return HashBytes(this, sizeof(BodyPair)); }
|
|
|
+ /// Get the hash value of this object
|
|
|
+ uint64 GetHash() const { return Hash64(*reinterpret_cast<const uint64 *>(this)); }
|
|
|
|
|
|
BodyID mBodyA;
|
|
|
BodyID mBodyB;
|
|
|
};
|
|
|
|
|
|
+static_assert(sizeof(BodyPair) == sizeof(uint64), "Mismatch in class size");
|
|
|
+
|
|
|
JPH_NAMESPACE_END
|