Currently the leading zero counting logic has a bug that if an address starts with a non-zero byte but has subsequent zero-bytes e.g. 0xaf0000b3... the logic will essentially skip the leading byte because 0 is used as the "magic value" for recognizing whether the value has been set yet.
I thought of going the Rust way and using options but I assume that has some overhead which wouldn't be good here? Using the unreachable 21 as the magic value fixes this.
Currently the leading zero counting logic has a bug that if an address starts with a non-zero byte but has subsequent zero-bytes e.g.
0xaf0000b3...
the logic will essentially skip the leading byte because0
is used as the "magic value" for recognizing whether the value has been set yet.I thought of going the Rust way and using options but I assume that has some overhead which wouldn't be good here? Using the unreachable 21 as the magic value fixes this.