tov / succinct-rs

Succinct Data Structures for Rust
Apache License 2.0
56 stars 15 forks source link

Remove unnecessary `& !0x7` #18

Open Validark opened 10 months ago

Validark commented 10 months ago

It is easy to prove we do not need & !0x7 because the maximum value it can operate on is 00001000_00000111_00000110_00000101_00000100_00000011_00000010_00000001 >> 53. Since the byte under the most significant byte can be a 7 at most, the upper 3 bits of that second byte are always 0. Therefore we do not need to zero them out.

00001000_00000111_00000110_00000101_00000100_00000011_00000010_00000001
         ^^^ these are always 0