I want to write a program that needs 40-bit integers. The machine where I'm writing it has 64 bit integers, but I'd like to check inside the program whether there are 64-bit integers available.
How could I do that efficiently?
On a 64-bit machine, this seems to work:
~0 >= 2**63
Is that safe (read: "portable") on different architectures?
Thinking about the problem, I also wondered if the Perl compiler, or interpreter could make these results questionable for a future version of Perl:
DB<2> sub bittest { use integer; return ((1 << $_[0]) >> $_[0]) != 0; }
DB<3> x bittest 31
0 1
DB<4> x bittest 63
0 1
DB<5> x bittest 64
0 ''