in reply to Re: reliably test integer size for portable bit-fiddling? (~0)
in thread reliably test integer size for portable bit-fiddling?

log(~0)/log(2)

Hmm, I tried a similar idea (get the index of the highest bit), but it failed. Now I remember:

helmut@w3:~$ perl -e 'print log(-1)/log(2),"\n";' Can't take log of -1 at -e line 1.

Thx, this is extremely fast and IMHO reliable, because it tests the capabilty directly.

Helmut "wollmers" Wollmersdorfer