Closed tomarrell closed 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
u64::heading_zeros
f64
log
Fixed in b34f31ddfb3a20ca68bd39375b7e4a15d570ca3a
Useful playground thanks to fulmicoton https://play.rust-lang.org/?gist=a1f228ed6dade1e95858aeef94478514&version=stable&mode=debug&edition=2015
"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 studyf64
and itslog
implementation to know whether it is correct or not." - fulmicoton