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

From: Date: Sat, 09 Jun 2007 22:21:01 +0000
Subject: Re: Re: Re: Re: php-cli vs python
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-256508@lists.php.net to get a copy of this message
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

« previous php.general (#256508) next »