1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 13:47:45 +00:00

AK: Add a 'HostIsLittleEndian' constant and use it instead of BYTE_ORDER

Previously we were using the preprocessor everywhere we needed this
constant, so let's move away from that and use a constexpr constant.
This commit is contained in:
Ali Mohammad Pur 2023-06-12 13:28:25 +03:30 committed by Ali Mohammad Pur
parent b3a295a5bd
commit 94f5389934
3 changed files with 26 additions and 27 deletions

View file

@ -225,7 +225,7 @@ static ThrowCompletionOr<Value> atomic_compare_exchange_impl(VM& vm, TypedArrayB
// 9. Let elementSize be TypedArrayElementSize(typedArray).
// 10. Let isLittleEndian be the value of the [[LittleEndian]] field of the surrounding agent's Agent Record.
constexpr bool is_little_endian = __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__;
constexpr bool is_little_endian = AK::HostIsLittleEndian;
// 11. Let expectedBytes be NumericToRawBytes(elementType, expected, isLittleEndian).
auto expected_bytes = MUST_OR_THROW_OOM(numeric_to_raw_bytes<T>(vm, expected, is_little_endian));