tomarrell / rust-elias-fano

Elias-Fano encoding implementation in Rust
MIT License
29 stars 5 forks source link

Refactor MSB #2

Closed tomarrell closed 6 years ago

tomarrell commented 6 years ago

"It is non trivial whether this code is actually correct for all u64 :

https://github.com/tomarrell/rust-elias-fano/blob/master/src/utils.rs#L33

u64::heading_zeros is a better implementation of msb. Again it compiles to one instruction, and it does not require to study f64 and its log implementation to know whether it is correct or not." - fulmicoton

tomarrell commented 6 years ago

Fixed in b34f31ddfb3a20ca68bd39375b7e4a15d570ca3a

tomarrell commented 6 years ago

Useful playground thanks to fulmicoton https://play.rust-lang.org/?gist=a1f228ed6dade1e95858aeef94478514&version=stable&mode=debug&edition=2015