Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77160 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8085 invoked from network); 12 Sep 2014 12:10:08 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 12 Sep 2014 12:10:08 -0000 Authentication-Results: pb1.pair.com header.from=leight@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=leight@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.182 as permitted sender) X-PHP-List-Original-Sender: leight@gmail.com X-Host-Fingerprint: 74.125.82.182 mail-we0-f182.google.com Received: from [74.125.82.182] ([74.125.82.182:49179] helo=mail-we0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 02/A0-01763-D92E2145 for ; Fri, 12 Sep 2014 08:10:05 -0400 Received: by mail-we0-f182.google.com with SMTP id k48so636975wev.13 for ; Fri, 12 Sep 2014 05:09:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; bh=cKAi+6rHEm7tNB36bbbELvbcIPljrV7vGbYvORrhIsk=; b=k2n8z0cZ+R+6clhOU3NVs66bpUUXts3z0hpUsBnlnk9fg8VqENfMuQ7LtfJhk0W+Cd gZsW8HW2AuLEAgefpPu4fjXq2DMIFdlPubMYFNLNNnyjgLpkk0oX5VOFNsyF1qv0b3Bg dqzmIeVbndJkJW/ELbmt0hXj12doQ/DCtiNG8QNiM1G3+0TwvCbnstBYGU/ZGMDRUDJe zgVUOIgt9YVVSf/p3vcpg94nVYXk7G05ZRF9auHH2bOglTaswsDGK6tGnYaBJXLVnorV boJiM0oeNqC9dHevDzwdhyqrJmzvGJPsdyBTVd+DcpgN9BRcMPWlFtfT1n2ajB3aTlc/ oGoA== MIME-Version: 1.0 X-Received: by 10.194.187.101 with SMTP id fr5mr10769919wjc.10.1410523795379; Fri, 12 Sep 2014 05:09:55 -0700 (PDT) Received: by 10.216.78.200 with HTTP; Fri, 12 Sep 2014 05:09:55 -0700 (PDT) Received: by 10.216.78.200 with HTTP; Fri, 12 Sep 2014 05:09:55 -0700 (PDT) In-Reply-To: References: Date: Fri, 12 Sep 2014 13:09:55 +0100 Message-ID: To: internals@lists.php.net Content-Type: multipart/alternative; boundary=047d7bd6b9acc55b840502dd29b1 Subject: Re: pack() and unpack() 64 bit format codes From: leight@gmail.com (Leigh) --047d7bd6b9acc55b840502dd29b1 Content-Type: text/plain; charset=UTF-8 On Sep 9, 2014 7:36 PM, "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. > > 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. So, no objections? --047d7bd6b9acc55b840502dd29b1--