moonbitlang / core

MoonBit's Core library
https://moonbitlang.com/
Apache License 2.0
586 stars 73 forks source link

use hex literals in xxhash and ryu #433

Closed lijunchen closed 4 months ago

lijunchen commented 4 months ago

xxhash and ryu were born in an era lacking hexadecimal integer literals to represent negative(literals such as 0x80000000 for negative integers were not feasible at that time) and unsigned integers(https://github.com/moonbitlang/core/issues/252). For the sake of improving code readability and maintainability, it should be beneficial to transition the decimal literals in these packages to hexadecimal, ensuring their values align with reference implementations.

Reference for ryu constant table: https://github.com/ulfjack/ryu/blob/master/ryu/d2s_small_table.h Reference for xxhash primes: https://github.com/Cyan4973/xxHash/blob/dev/doc/xxhash_spec.md