in reply to Re^2: Decoding binary information
in thread Decoding binary information
Perl can handle 32 bit integers just fine. You could append '00', pack it into a 4 byte structure (a long), and unpack it as a signed long; and finally divide by 256, for the 2 extra zeros you added.
Or, maybe easier, subtract 2**24 if you see it's 2**23 or more.print unpack('l', pack 'L', hex 'F4EC9E00')/256;
$n = hex 'F4EC9E'; if($n >= 2**23) { $n -= 2**24 } print $n;
|
---|