dermesser / integer-encoding-rs

Integer encoding for primitive integer types: Supports varint/varint+zigzag and fixed-length integer encoding and decoding, and provides synchronous and asynchronous Write/Read types for easily writing/reading integers.
Other
66 stars 16 forks source link

Impl FixedInt for i8/u8 and fix size for isize/usize #25

Closed changrui0608 closed 2 years ago

changrui0608 commented 2 years ago
  1. AddedImpl FixedInt for i8 and u8, which could make some users' code (including mime) more consistent. I avoided endian converion on i8/u8, thinking this should bring a better performance.
  2. Removed the size parameter sz from the macro impl_fixedint, use std::mem::size_of to obtain the size. The size of isize/usize may not be 8 on some platform, operating raw memory on with incorrect length should cause unpredictable behavior (if I've got it right).

This is my first public PR on Github, and I'm still new to Rust language, so please let me know if something is incorrect.

dermesser commented 2 years ago

Thank you, the tests already pass, and I will take a closer look soon. It looks great at first sight!