BurntSushi / byteorder

Rust library for reading/writing numbers in big-endian and little-endian.
The Unlicense
984 stars 144 forks source link

Add `read_u40` #168

Closed Stargateur closed 4 years ago

Stargateur commented 4 years ago

I need to read 5 bytes number but there seem to be no way to do it. There is a read_u24 so why not read_u40 too ?

BurntSushi commented 4 years ago

I kind of regret adding read_u24, as I'm not convinced how common it actually is. But it was added in this PR, and its commonality as a special case was the main reason to use it.

I'm not inclined to add u40, u48, u56 and so on. This is why read_uint exists. Please use that instead.