Bastian Angerstein wrote:
> Hello,
>
> I am working with SNMP and 64 Bit unsigned Intergers.
>
[snip]
> The thing that I do is
> $var = unpack("N*", $any64bitvalue);
> or
> $var = unpack("I*", $any64bitvalue);
> to make sure the number is an unsigned Interger.
why are you doing the above? 'N*' gives you a 32 bit big-endian number and
'I*' simply gives you a 32 bit number. none of them got you closer to your
64 bit goal.
>
> When I access the number in $var (as a string or a number) it has ben
> chopped to a 32 Bit number.
>
because you are telling it to chop it to 32 bit from the above unpack
statements
> Now I tested Math:BigInt $var = Math::BigInt->new(unpack("I*",
> $any64bitvalue));
> But still on the $var is chopped to 32 Bit in the next subroutine;
>
> This means that the value 36893488147419103231 becomes 8589934591.
no it isn't. Math::BigInt has no problem doing that:
[panda]# perl -MMath::BigInt -le '
print Math::BigInt->new("36893488147419103231")->badd(1)'
36893488147419103232
as you can see it's not chopped. in fact, try:
[panda]# perl -le '$_=36893488147419103231+1; print'
3.68934881474191e+19
and see what you got.
david
--
s,.*,<<,e,y,\n,,d,y,.s,10,,s
.ss.s.s...s.s....ss.....s.ss
s.sssss.sssss...s...s..s....
...s.ss..s.sss..ss.s....ss.s
s.sssss.s.ssss..ss.s....ss.s
..s..sss.sssss.ss.sss..ssss.
..sss....s.s....ss.s....ss.s
,....{4},"|?{*=}_'y!'+0!$&;"
,ge,y,!#:$_(-*[./<[EMAIL PROTECTED],b-t,
.y...,$~=q~=?,;^_#+?{~,,$~=~
y.!-&*-/:[EMAIL PROTECTED] ().;s,;,
);,g,s,s,$~s,g,y,y,%,,g,eval
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]