Hi,
Here is the issue. From the program snippet I have Base: 0x1800000000, Size: 0x3FFE7FFFFFFFF which are of 40 and 56 bits. SO I used use bignum to do the math but summing them up I always failed having correct result.
perl interpreter info,
perl, v5.8.8 built for i386-linux-thread-multi
Program snippet,
use bignum qw/hex/;
$x ="SAD_MISS_REGION:Base:Size
SAD_MISS_REGION:0x100000000:0x100000000
SAD_MISS_REGION:0x400000000:0x400000000
SAD_MISS_REGION:0x1800000000:0x3FFE7FFFFFFFF";
while ( $x =~ /SAD_MISS_REGION:(.+):(.+)/g ) {
$p = $1; $q = $2;
$phex = hex($1); $qhex = hex($2);
}
print "\n\n\n\nBase: $p, Size: $q \n";
print "\n\n\n\nBaseinDecimal: $phex, SizeinDesimal: $qhex \n";
$z = $phex + $qhex;
print "Z has summed up value: $z\n";
$zhex = unpack "H*", $z;
#$zhex = uc(sprintf("%x\n", $z));
print "Hexadecimal number of Z: ", $zhex, "\n";
output:
Base: 0x1800000000, Size: 0x3FFE7FFFFFFFF
BaseinDecimal: 103079215104, SizeinDesimal: 1125796827627519
Z has summed up value: 1125899906842623
Hexadecimal number of Z: 31313235383939393036383432363233
------------------------------------------------------------
Math::BigInt seems to be a solution but i dont have it installed at my remote machine. Need a work around. Please help....