KillingSpark/zstd-rs

Use Byteorder or std instead of manual shifting

hellow554 opened this issue · 2 comments

let dict_id = dict_id[0] as u32
+ ((dict_id[1] as u32) << 8)
+ ((dict_id[2] as u32) << 16)
+ ((dict_id[3] as u32) << 24);

There are numerous places like these, where you manually create a integer from bytes.
You should either use the Byteorder crate (which is already in the dependencies and rarely used) or use the std variants {from,to}_{le,be,ne}_bytes.

I'll look into the std lib's functions. I'd like to avoid the byteorder crate as much as possible to reduce the amount of unsafe code used. I juts pulled it in because it introduced a big performance boost

I moved all of this into one module decoding::little_endian (which I should have done in the first place...)