B
Bill Davidsen
I am reading a log file which has 32 bit unsigned values, and need to
take the difference between them. If the difference is negative I assume
that the data counter has rolled over, and I want to add 231 to get the
correct value. For readability I wanted to put the value in a variable
so it would be obvious what was happening.
So I wrote:
$Roll32 = (1 << 32); # the way I would for a C macro
but the value was (after I did some looking) one! Then I wrote:
$Roll32 = 1 << 32; # in case the parens were a issue
bit it was still one, so I wrote:
$Roll32 = ( 4 * (1 << 30) ); # which works (4G)
This is the first time perl has failed to do int=>double conversion when
expected (by me). Just a note in case someone else is ever doing
similar, perl on Linux 32 bit, v5.6.1, v5.8.0, v5.8.5 builds.
take the difference between them. If the difference is negative I assume
that the data counter has rolled over, and I want to add 231 to get the
correct value. For readability I wanted to put the value in a variable
so it would be obvious what was happening.
So I wrote:
$Roll32 = (1 << 32); # the way I would for a C macro
but the value was (after I did some looking) one! Then I wrote:
$Roll32 = 1 << 32; # in case the parens were a issue
bit it was still one, so I wrote:
$Roll32 = ( 4 * (1 << 30) ); # which works (4G)
This is the first time perl has failed to do int=>double conversion when
expected (by me). Just a note in case someone else is ever doing
similar, perl on Linux 32 bit, v5.6.1, v5.8.0, v5.8.5 builds.