my ($a,$b,$c,$d) = unpack , 'lssQ' , $buffer
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
if ( $platform =~ /i486/smx ) {
my ($byteoffset1,$byteoffset2,undef,$filenumber) = unpack'lssLL',${$buffer};
use Math::BigInt;
my $sign=($byteoffset1&0x80000000);
if($sign) {
$byteoffset1^=-1;
$byteoffset2^=-1;
++$byteoffeset2;
$byteoffset2%=2**32;
++$byteoffset1 unless $byteoffset2;
}
my $i=new Math::BigInt $byteoffeset1;
$i*=2**32;
$i+=$byteoffset2;
if ( $sign ) { $i=-$i ; } ;
$byteoffset = $i;
}
1 2 3 4 5 6 7 8 9 10 11
#!/usr/bin/perl use strict; use warnings; use Math::BigInt; my $data=pack('LL',0,12345678); my $str=unpack('H16',$data); my $c = Math::BigInt->from_hex($str); print "$c\n";