Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:75029 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11510 invoked from network); 21 Jun 2014 19:48:10 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jun 2014 19:48:10 -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.216 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.216 imap10-3.ox.privateemail.com Received: from [192.64.116.216] ([192.64.116.216:40998] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EC/70-06324-971E5A35 for ; Sat, 21 Jun 2014 15:48:10 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 3F81A2400D5; Sat, 21 Jun 2014 15:48:06 -0400 (EDT) X-Virus-Scanned: Debian amavisd-new at imap10.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap10.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id LKbEy4z9m35l; Sat, 21 Jun 2014 15:48:06 -0400 (EDT) Received: from [192.168.0.15] (unknown [90.210.122.167]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 1AD992400D2; Sat, 21 Jun 2014 15:48:04 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.2\)) In-Reply-To: Date: Sat, 21 Jun 2014 20:48:02 +0100 Cc: PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <38147771-B249-4D74-9F1A-D926B5BDBB1A@ajf.me> References: To: Nikita Popov X-Mailer: Apple Mail (2.1878.2) Subject: Re: [PHP-DEV] [DRAFT][RFC] Big Integer Support From: ajf@ajf.me (Andrea Faulds) On 20 Jun 2014, at 15:58, Nikita Popov wrote: > Hey Andrea, this looks really interesting! >=20 Glad you think so. :) > Could you please submit a PR from your branch, so it's possible to = review the code? Oh, good idea. I=92ll do so soon. I should note the patch is very much = unfinished (it works, but there are quite a few problems and I think I = broke the math bit of ext/standard ;) and there are some things I=92m = yet to implement. It also needs some tests of its own; at the moment = I=92ve just fixed and removed the skip condition from a few 64-bit ones, = with the reasoning that if this is implemented right, they should act = identically on 32-bit CPUs. However, you can currently create bigints, they=92re reference counted = and copied-on-write correctly, they don=92t leak memory or segfault, and = operations overflow correctly. >=20 > Regarding the RFC text, I think you mixed up some left and right = shifts. "<< 65 will result in zero" is probably supposed to be >> 65? = And "right shifts will promote to bigints" probably is talking about = left shifts? >=20 Oops, yes. I=92ll fix that right away. > Btw, I wouldn't worry about the change in shifts larger than the = integer width. Those have always been UB inherited from using UB of the = C language. The cyclic behavior is only an idiosyncrasy of the x86 = architecture - other ISAs like ARM (iirc) will not exhibit the = behaviour. Right. I=92ll need to fix up the code so that it only does the necessary = checks for cyclic behaviour on the platforms which do it. Currently = there=92s no such check. -- Andrea Faulds http://ajf.me/