hashmismatch / packed_struct.rs

Bit-level packing and unpacking for Rust
MIT License
163 stars 30 forks source link

Primitive Enums roundtrip tests and fixes #75

Closed rudib closed 3 years ago

rudib commented 3 years ago

Fixes the case where the first discriminant value was incorrect. Added tests for negative and positive cases.

qm3ster commented 3 years ago

Wouldn't initializing them to

    let mut d = 1;
    let mut neg = true;

solve this without Option? Or is that considered confusing?