Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:26425 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 3764 invoked by uid 1010); 9 Nov 2006 04:46:41 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 3749 invoked from network); 9 Nov 2006 04:46:41 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 Nov 2006 04:46:41 -0000 Authentication-Results: pb1.pair.com header.from=php_lists@realplain.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php_lists@realplain.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain realplain.com from 69.179.208.43 cause and error) X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 69.179.208.43 msa3-mx.centurytel.net Linux 2.4/2.6 Received: from [69.179.208.43] ([69.179.208.43:33591] helo=msa3-mx.centurytel.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id BB/13-12290-0B2B2554 for ; Wed, 08 Nov 2006 23:46:41 -0500 Received: from pc1 (72-161-146-107.dyn.centurytel.net [72.161.146.107]) by msa3-mx.centurytel.net (8.13.6/8.13.6) with SMTP id kA94ka9F016243 for ; Wed, 8 Nov 2006 22:46:37 -0600 Message-ID: <008601c703ba$0a9f4940$0201a8c0@pc1> To: Date: Wed, 8 Nov 2006 22:46:37 -0600 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0083_01C70387.BFCBA0D0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Subject: Optimization for ..._MULTIPLY_LONG on more systems From: php_lists@realplain.com ("Matt Wilmas") ------=_NextPart_000_0083_01C70387.BFCBA0D0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit Hi, Here's an additional ZEND_SIGNED_MULTIPLY_LONG() for platforms with 32-bit longs that don't use the assembly version (so all Windows systems at least?). On my Windows system, mul_function() is 40% faster with this version (no overflow), which makes PHP's * operator 20% faster; with overflow mul_function() is 20% faster (though I don't see any difference with the * operator). The macro is also used in safe_emalloc()... Patch just against 5_2 as the file versions are the only difference. Matt ------=_NextPart_000_0083_01C70387.BFCBA0D0 Content-Type: text/plain; name="multiply_long.txt" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="multiply_long.txt" Index: zend_multiply.h=0A= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=0A= RCS file: /repository/ZendEngine2/zend_multiply.h,v=0A= retrieving revision 1.10.2.1=0A= diff -u -r1.10.2.1 zend_multiply.h=0A= --- zend_multiply.h 4 Jan 2006 23:53:04 -0000 1.10.2.1=0A= +++ zend_multiply.h 9 Nov 2006 03:54:01 -0000=0A= @@ -31,6 +31,19 @@=0A= else (lval) =3D __tmpvar; \=0A= } while (0)=0A= =0A= +#elif SIZEOF_LONG_LONG > SIZEOF_LONG=0A= +=0A= +#define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \=0A= + long long __result =3D (long long) (a) * (long long) (b); \=0A= + if (__result > LONG_MAX || __result < LONG_MIN) { \=0A= + (dval) =3D (double) __result; \=0A= + (usedval) =3D 1; \=0A= + } else { \=0A= + (lval) =3D (long) __result; \=0A= + (usedval) =3D 0; \=0A= + } \=0A= +} while (0)=0A= +=0A= #else=0A= =0A= #define ZEND_SIGNED_MULTIPLY_LONG(a, b, lval, dval, usedval) do { \=0A= ------=_NextPart_000_0083_01C70387.BFCBA0D0--