FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » signed int64 pack/unpack
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: signed int64 pack/unpack [message #184615 is a reply to message #184593] Sun, 12 January 2014 23:27 Go to previous messageGo to previous message
Ben Bacarisse is currently offline  Ben Bacarisse
Messages: 82
Registered: November 2013
Karma:
Member
cameron7(at)gmail(dot)com writes:

> I guess I'll reply with my own solution. Turns out there are 2
> separate issues here.

Here's mine. You might have to alter the order of the two 32-bit
components to match your external format. I've used the same names you
might be able to drop it into your tests.

echo "PACKING: ".$i64.PHP_EOL;

$ps = pack('N2', $i64 >> 32, $i64 & 0xffffffff);

list(, $hi, $lo) = unpack('N2', $ps);
$unpack = ($hi << 32) + $lo;

echo "UNPACKED: ".$unpack.PHP_EOL;

--
Ben.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: how did I wind up with double headers?
Next Topic: Switch question
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Fri Nov 22 07:18:59 GMT 2024

Total time taken to generate the page: 0.04787 seconds