mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 16:18:12 +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:
parent
b3a295a5bd
commit
94f5389934
3 changed files with 26 additions and 27 deletions
|
@ -176,10 +176,8 @@ static constexpr auto max_representable_power_of_ten_in_u64 = 19;
|
|||
static_assert(1e19 <= static_cast<double>(NumericLimits<u64>::max()));
|
||||
static_assert(1e20 >= static_cast<double>(NumericLimits<u64>::max()));
|
||||
|
||||
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
||||
# error Float parsing currently assumes little endian, this fact is only used in fast parsing of 8 digits at a time \
|
||||
you _should_ only need to change read eight_digits to make this big endian compatible.
|
||||
#endif
|
||||
static_assert(HostIsLittleEndian, "Float parsing currently assumes little endian, this fact is only used in fast parsing of 8 digits at a time"
|
||||
"\nyou _should_ only need to change read eight_digits to make this big endian compatible.");
|
||||
constexpr u64 read_eight_digits(char const* string)
|
||||
{
|
||||
u64 val;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue