Re: Re: Re: Re: php-cli vs python

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Abdullah Ramazanoglu dedi ki:

> $key = pack("N*", 0x12345678, 0x9abcdef0, 0x87654321, 0x0fedcba9);
> 
> Well, second and third 32-bit hex values were automatically converted by
> PHP to float, before packing, because PHP tries to cast them into signed
> 32-bit integers, which can't be represented with, as they're above
> 0x7fffffff (2^31-1). So, PHP casts them to floats. As a workaround I had
> to use modulo-8 values for the top hex digits. (E.g. 0x1abcdef0 instead
> of 0x9abcdef0).

This is interestingly incorrect. I've just rechecked it and seen that
pack "N" works with unsigned integers as documented.

I remember it packing large (>2^31-1) integers into float, but I don't
remember my earlier test details. Obviously I've done something wrong in
my earlier trials.

Kind regards,
-- 
Abdullah Ramazanoglu
aramazan ÄT myrealbox D0T cöm

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux