Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: unpacking unsigned long longs

by ambrus (Abbot)
on Jul 02, 2009 at 19:32 UTC ( [id://776838]=note: print w/replies, xml ) Need Help??


in reply to unpacking unsigned long longs

Just unpack a signed long long int instead and then convert it to unsigned by bitwise anding with 0xffffffffffffffff (with the right number of fs in case I goofed it up). Or try Math::Int64::native_to_uint64.

Update: If you are on a 64-bit platform (or you are on a 32-bit platform but your perl is specifically compiled so that perl integers are 64 bit which is rare), then you can use the "J" unpack template, and, in the first case, "L!" as well. Otherwise you could also unpack two 32-bit integers and combine them in the right direction.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://776838]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-04-18 22:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found