I tested with high bits using int rand(2**64), medium bits int rand(2**32) and lower bits int rand(2**16) for 1e6 iterations.sub by_string { my $n = shift; return length(sprintf "%b", $n) - 1; }
log linear sprintf 0.2917 0.4427 0.3370 avg_sig=62 0.2786 2.8430 0.3056 avg_sig=30 0.2826 4.1060 0.2986 avg_sig=14
In reply to Re^2: Most Significant Set Bit
by Danny
in thread Most Significant Set Bit
by coldr3ality
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |