Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75628 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89451 invoked from network); 17 Jul 2014 02:34:06 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Jul 2014 02:34:06 -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.200 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.200 imap1-2.ox.privateemail.com Received: from [192.64.116.200] ([192.64.116.200:54567] helo=imap1-2.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/01-19007-D1637C35 for ; Wed, 16 Jul 2014 22:34:06 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 94AEAB00085; Wed, 16 Jul 2014 22:34:02 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap1.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap1.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id S96kt8Eg4xl0; Wed, 16 Jul 2014 22:34:02 -0400 (EDT) Received: from app1.ox.registrar-servers.com (app1.ox.registrar-servers.com [198.187.29.231]) (using TLSv1 with cipher AES128-SHA (128/128 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id F0CA0B0007B; Wed, 16 Jul 2014 22:34:01 -0400 (EDT) Date: Thu, 17 Jul 2014 03:34:01 +0100 (BST) Reply-To: Andrea Faulds To: tjerk.meesters@gmail.com, pollita@php.net Cc: bishop@php.net, internals@lists.php.net Message-ID: <1240076591.91249.1405564441970.open-xchange@app1.ox.registrar-servers.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Priority: 3 Importance: Medium X-Mailer: Open-Xchange Mailer v7.4.2-Rev29 Subject: Re: [PHP-DEV] [RFC] intdiv() From: ajf@ajf.me (Andrea Faulds) > On July 17, 2014 at 3:17 AM Sara Golemon wrote: > > All that said, *I* think the tradeoff of an extra idivq in the > (probably more common) remainder case is worth it in the interest > keeping PHP's syntax simple. What are you suggesting you do for an integer division, then? ($a - ($a % $b)) / $ b? The division operator already returns an integer. Or should I just use intdiv()? > If we're really set on adding a new operator, I'd vote for something > which provides dividend *and* remainder in some way. (Useful for time > arithmetic, for example) Isn't that the division operator? ;) In all seriousness, you could just have the compiler optimise using % and %% successively with the same operands to just be a single division, if that's possible. -- Andrea Faulds http://ajf.me/