develooper Front page | perl.perl5.porters | Postings from October 2001

[PATCH] tweak divide

From:
Nicholas Clark
Date:
October 26, 2001 14:52
Subject:
[PATCH] tweak divide
Message ID:
20011026225217.B20275@plum.flirble.org
The comment's explanation doesn't feel very eloquent.
In theory an optimiser should be able to figure that the
|| (right > ((UV)1 << NV_PRESERVES_UV_BITS
is redundant. In practice, how many will?

Nicholas Clark

--- pp.c.orig	Fri Oct 19 21:11:13 2001
+++ pp.c	Fri Oct 26 19:59:13 2001
@@ -1074,9 +1074,13 @@
 #else
                 /* Otherwise we only attempt it if either or both operands
                    would not be preserved by an NV.  If both fit in NVs
-                   we fall through to the NV divide code below.  */
-                && ((left > ((UV)1 << NV_PRESERVES_UV_BITS))
-                    || (right > ((UV)1 << NV_PRESERVES_UV_BITS)))
+                   we fall through to the NV divide code below.  However,
+                   as left >= right to ensure integer result here, we know that
+                   we can skip the test on the right operand - right big
+                   enough not to be preserved can't get here unless left is
+                   also too big.  */
+                   
+                && (left > ((UV)1 << NV_PRESERVES_UV_BITS))
 #endif
                 ) {
                 /* Integer division can't overflow, but it can be imprecise.  */



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About