Re: pack() and unpack() 64 bit format codes
| From: | Andrea Faulds | Date: | Tue, 09 Sep 2014 20:16:11 +0000 |
| Subject: | Re: pack() and unpack() 64 bit format codes | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-77118@lists.php.net to get a copy of this message | ||
On 9 Sep 2014, at 19:36, Leigh <leight@gmail.com> wrote:
> Hi Internals,
>
> I would like to propose giving pack() and unpack() 64 bit format
> codes, mimicking the current behaviour of 32 bit format codes.
What would this do on 32-bit platforms?
> Pack and unpack are obviously functions inspired by Perl, which has
> the 64 bit format codes 'q' and 'Q'. So the first half of my proposal
> is to give pack() and unpack() these options.
>
> q - signed long long (always 64 bit, machine byte order)
> Q - unsigned long long (always 64 bit, machine byte order)
>
> Perl does not have format codes to specify endianness, so the second
> half of my proposal is to introduce two more format codes for PHP that
> behave differently from Perl.
>
> J - unsigned long long (always 64 bit, big endian byte order)
> P - unsigned long long (always 64 bit, little endian byte order)
>
> I have chosen these letters _because_ they already exist in Perl,
> however their function does not suit PHP. J is for Perl internal
> integers, and P is for a pointer to a structure. Both of these are
> things that make no sense to support in PHP.
Why is there no big/little-endian signed long long?
--
Andrea Faulds
http://ajf.me/