$ perl -le "print log(~0+1)/log(2)" 32
or, to be safe
$ perl -e 'printf "%.0f\n", log(~0+1)/log(2)' 32
- tye
In reply to Re^4: reliably test integer size for portable bit-fiddling? (~0)
by tye
in thread reliably test integer size for portable bit-fiddling?
by wollmers
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |