in reply to portably finding max integer
The following seems to be accurate
$max_unsigned_int = ~0; $max_signed_int = -1 >> 1;
according to perlop:
Unary "~" performs bitwise negation, i.e., 1’s complement. For example, "0666 & ~027" is 0640. (See also "Integer Arithmetic" and "Bitwise String Operators".) Note that the width of the result is platform-dependent: ~0 is 32 bits wide on a 32-bit platform, but 64 bits wide on a 64-bit platform, so if you are expecting a certain bit width, remember to use the & operator to mask off the excess bits.
|
---|
In Section
Seekers of Perl Wisdom