Currently, read_u64 is only used on little-endian architectures, providing optimizations only for little-endian systems. Since this is an important optimization during parsing, it should be important to ensure this works on all architecture byte-orders, big and little.
Fix
Change read_u64 and write_u64 to use u64::from_le and u64::to_le, respectively.
Remove all cfg_if!(target_endian = "little") conditions.
Test to ensure a the number is read and written as little-endian bytes.
Issue
Currently,
read_u64
is only used on little-endian architectures, providing optimizations only for little-endian systems. Since this is an important optimization during parsing, it should be important to ensure this works on all architecture byte-orders, big and little.Fix
read_u64
andwrite_u64
to useu64::from_le
andu64::to_le
, respectively.cfg_if!(target_endian = "little")
conditions.le
.