aldanor / fast-float-rust

Super-fast float parser in Rust (now part of Rust core)
https://docs.rs/fast-float
Apache License 2.0
275 stars 20 forks source link

Removed endian-dependent codepaths. #22

Closed Alexhuszagh closed 3 years ago

Alexhuszagh commented 3 years ago

Fixed #19.

aldanor commented 3 years ago

Makes total sense, I must have simply forgotten about from_bits() methods while using C++ code as a reference (where you have to do everything manually).

I was a bit confused by v & 0xFFFFFFFF for a moment for big-endian targets but I think it is correct indeed (as also shown in #19). For our peace of mind, we should probably have at least one BE target in the CI.

Alexhuszagh commented 3 years ago

@aldanor It's unnecessary, but it's just for peace of mind. x as u32 will just take the lower 32-bits, which that bitmask does (which, at an decent optimization level, will always be a no-op).