Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77118 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 57939 invoked from network); 9 Sep 2014 20:16:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Sep 2014 20:16:21 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.208 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.208 imap2-3.ox.privateemail.com Received: from [192.64.116.208] ([192.64.116.208:41422] helo=imap2-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3B/15-08634-2106F045 for ; Tue, 09 Sep 2014 16:16:20 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id BD9858C0083; Tue, 9 Sep 2014 16:16:15 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap2.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap2.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id mfZsffM8uu2j; Tue, 9 Sep 2014 16:16:15 -0400 (EDT) Received: from oa-res-27-90.wireless.abdn.ac.uk (oa-res-27-90.wireless.abdn.ac.uk [137.50.27.90]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 9D90D8C007B; Tue, 9 Sep 2014 16:16:14 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Tue, 9 Sep 2014 21:16:11 +0100 Cc: internals@lists.php.net Content-Transfer-Encoding: 7bit Message-ID: <7E2B341D-F0BD-4E3A-BE41-FCD5539EC8D3@ajf.me> References: To: Leigh X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] pack() and unpack() 64 bit format codes From: ajf@ajf.me (Andrea Faulds) On 9 Sep 2014, at 19:36, Leigh 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/