Remove f32 & f64 from MemDecoder/MemEncoder by scottmcm 路 Pull Request #109984 路 rust-lang/rust (original) (raw)

Sure thing; done.

If you're here in the future: you might want to change how this works, because using LEB128 for floats is a poor choice -- even a simple float like 1.0_f32 takes 5 bytes since all the zeros are in the low bits. It should probably either be always 4 bytes or do a swap_bytes before the LEB128 encoding.

Indeed, the only f32s for which ordinary LEB128 encoding is better than "always 4 bytes" are 0 through 2.938734e-39. And I suspect those (other than zero itself) are not particularly common -- after all, they're subnormal.