Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77116 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51131 invoked from network); 9 Sep 2014 18:36:56 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Sep 2014 18:36:56 -0000 Authentication-Results: pb1.pair.com smtp.mail=leight@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=leight@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.178 as permitted sender) X-PHP-List-Original-Sender: leight@gmail.com X-Host-Fingerprint: 209.85.212.178 mail-wi0-f178.google.com Received: from [209.85.212.178] ([209.85.212.178:40667] helo=mail-wi0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 4E/34-08634-6C84F045 for ; Tue, 09 Sep 2014 14:36:55 -0400 Received: by mail-wi0-f178.google.com with SMTP id hi2so1716261wib.5 for ; Tue, 09 Sep 2014 11:36:51 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:date:message-id:subject:from:to:content-type; bh=SJ/9ZO4LJBOHXs2q1j3sKjQCn5OuB/G4R0pVyd56vGY=; b=S7fllc+bStJP0BVXr/LHbiUmGcxj5mGbd5hKhBZDAIuaB+/Nuzd83Gvd/VwuECCYsO X+3/tggZJUI54ujyKK5STiDLfQlKVyxE4BzbY6FL8sYU/Rv5PfMWX3leXZknhKY8B4jT L9kkjqqAsR7gv3/DP50xQuJ/IczBc6E6j8qugOKNGJYGsvw0pnxGSdCerVNXz67wXXDj 2qPby+RZtRvEij0tX6ay5RD6mkvr9W6ytos5/k3bVUjRD33wezAog3UY+1lAXq9ZfqEV aPN1NbUD6vNu2kXlVV2dwQslJJPe6vyFCItFJIJdLSMlbIbjI2WBSrXm4WgY5ALAh+ag 0K8g== MIME-Version: 1.0 X-Received: by 10.180.187.20 with SMTP id fo20mr32266582wic.58.1410287811778; Tue, 09 Sep 2014 11:36:51 -0700 (PDT) Received: by 10.217.45.135 with HTTP; Tue, 9 Sep 2014 11:36:51 -0700 (PDT) Date: Tue, 9 Sep 2014 19:36:51 +0100 Message-ID: To: internals@lists.php.net Content-Type: text/plain; charset=UTF-8 Subject: pack() and unpack() 64 bit format codes From: leight@gmail.com (Leigh) Hi Internals, I would like to propose giving pack() and unpack() 64 bit format codes, mimicking the current behaviour of 32 bit format codes. 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. I have ordered them so that J < P in the same way that N < V, hopefully making it a bit more intuitive for developers to remember what the codes mean (also P rhymes with V.. kinda) I don't think this requires an RFC, as it does not break any existing expected behaviour. I'd like to hear the lists opinion on introducing these new formatting options. Provisional PR: https://github.com/php/php-src/pull/812 Cheers, Leigh.