cpp: Use little-endian load for equal comparison
@@ -159,10 +159,9 @@ inline constexpr uint64_t fnv1a_by64(uint64_t h, uint64_t x) noexcept
/// The "equal to" comparison operator for the evmc::address type.
inline constexpr bool operator==(const address& a, const address& b) noexcept
{
- // TODO: Report bug in clang keeping unnecessary bswap.
- return load64be(&a.bytes[0]) == load64be(&b.bytes[0]) &&
- load64be(&a.bytes[8]) == load64be(&b.bytes[8]) &&
- load32be(&a.bytes[16]) == load32be(&b.bytes[16]);
+ return load64le(&a.bytes[0]) == load64le(&b.bytes[0]) &&
+ load64le(&a.bytes[8]) == load64le(&b.bytes[8]) &&
+ load32le(&a.bytes[16]) == load32le(&b.bytes[16]);
}
/// The "not equal to" comparison operator for the evmc::address type.
@@ -202,10 +201,10 @@ inline constexpr bool operator>=(const address& a, const address& b) noexcept
/// The "equal to" comparison operator for the evmc::bytes32 type.
inline constexpr bool operator==(const bytes32& a, const bytes32& b) noexcept
{
- return load64be(&a.bytes[0]) == load64be(&b.bytes[0]) &&
- load64be(&a.bytes[8]) == load64be(&b.bytes[8]) &&
- load64be(&a.bytes[16]) == load64be(&b.bytes[16]) &&
- load64be(&a.bytes[24]) == load64be(&b.bytes[24]);
+ return load64le(&a.bytes[0]) == load64le(&b.bytes[0]) &&
+ load64le(&a.bytes[8]) == load64le(&b.bytes[8]) &&
+ load64le(&a.bytes[16]) == load64le(&b.bytes[16]) &&
+ load64le(&a.bytes[24]) == load64le(&b.bytes[24]);
}
/// The "not equal to" comparison operator for the evmc::bytes32 type.
