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

[PATCH] remove small IVop redundancy

Thread Next
From:
Nicholas Clark
Date:
October 25, 2001 14:48
Subject:
[PATCH] remove small IVop redundancy
Message ID:
20011025224827.M66471@plum.flirble.org
When I wrote the IV stuff, I didn't think it through fully. All these test
clauses are actually un-necessary, as the results they shortcut return would
also be returned by the next test anyway.
Passes all tests here, but doesn't seem to make things any faster, even
op/cmp.t, which is does about 5000 comparisons, last I counted.
(about 0.3% smaller pp.o file)

Nicholas Clark

--- pp_hot.c.orig	Thu Oct 18 02:01:03 2001
+++ pp_hot.c	Fri Oct 19 21:07:41 2001
@@ -294,10 +294,6 @@
 		    uv = SvUVX(*(SP+1)); /* Do I want TOPp1s() ? */
 		}
 		/* we know iv is >= 0 */
-		if (uv > (UV) IV_MAX) {
-		    SETs(&PL_sv_no);
-		    RETURN;
-		}
 		SETs(boolSV((UV)iv == uv));
 		RETURN;
 	    }
--- pp.c.orig	Tue Oct  9 03:50:56 2001
+++ pp.c	Fri Oct 19 21:11:13 2001
@@ -1494,11 +1494,6 @@
 		    RETURN;
 		}
 		auv = SvUVX(TOPs);
-		if (auv >= (UV) IV_MAX) {
-		    /* As (b) is an IV, it cannot be > IV_MAX */
-		    SETs(&PL_sv_no);
-		    RETURN;
-		}
 		SETs(boolSV(auv < (UV)biv));
 		RETURN;
 	    }
@@ -1515,11 +1510,6 @@
 		}
 		buv = SvUVX(TOPs);
 		SP--;
-		if (buv > (UV) IV_MAX) {
-		    /* As (a) is an IV, it cannot be > IV_MAX */
-		    SETs(&PL_sv_yes);
-		    RETURN;
-		}
 		SETs(boolSV((UV)aiv < buv));
 		RETURN;
 	    }
@@ -1572,11 +1562,6 @@
 		    RETURN;
 		}
 		auv = SvUVX(TOPs);
-		if (auv > (UV) IV_MAX) {
-		    /* As (b) is an IV, it cannot be > IV_MAX */
-		    SETs(&PL_sv_yes);
-		    RETURN;
-		}
 		SETs(boolSV(auv > (UV)biv));
 		RETURN;
 	    }
@@ -1593,11 +1578,6 @@
 		}
 		buv = SvUVX(TOPs);
 		SP--;
-		if (buv >= (UV) IV_MAX) {
-		    /* As (a) is an IV, it cannot be > IV_MAX */
-		    SETs(&PL_sv_no);
-		    RETURN;
-		}
 		SETs(boolSV((UV)aiv > buv));
 		RETURN;
 	    }
@@ -1650,11 +1630,6 @@
 		    RETURN;
 		}
 		auv = SvUVX(TOPs);
-		if (auv > (UV) IV_MAX) {
-		    /* As (b) is an IV, it cannot be > IV_MAX */
-		    SETs(&PL_sv_no);
-		    RETURN;
-		}
 		SETs(boolSV(auv <= (UV)biv));
 		RETURN;
 	    }
@@ -1671,11 +1646,6 @@
 		}
 		buv = SvUVX(TOPs);
 		SP--;
-		if (buv >= (UV) IV_MAX) {
-		    /* As (a) is an IV, it cannot be > IV_MAX */
-		    SETs(&PL_sv_yes);
-		    RETURN;
-		}
 		SETs(boolSV((UV)aiv <= buv));
 		RETURN;
 	    }
@@ -1728,11 +1698,6 @@
 		    RETURN;
 		}
 		auv = SvUVX(TOPs);
-		if (auv >= (UV) IV_MAX) {
-		    /* As (b) is an IV, it cannot be > IV_MAX */
-		    SETs(&PL_sv_yes);
-		    RETURN;
-		}
 		SETs(boolSV(auv >= (UV)biv));
 		RETURN;
 	    }
@@ -1749,11 +1714,6 @@
 		}
 		buv = SvUVX(TOPs);
 		SP--;
-		if (buv > (UV) IV_MAX) {
-		    /* As (a) is an IV, it cannot be > IV_MAX */
-		    SETs(&PL_sv_no);
-		    RETURN;
-		}
 		SETs(boolSV((UV)aiv >= buv));
 		RETURN;
 	    }
@@ -1825,11 +1785,6 @@
 		    }
 		    uv = SvUVX(*(SP+1)); /* Do I want TOPp1s() ? */
 		}
-		/* we know iv is >= 0 */
-		if (uv > (UV) IV_MAX) {
-		    SETs(&PL_sv_yes);
-		    RETURN;
-		}
 		SETs(boolSV((UV)iv != uv));
 		RETURN;
 	    }
@@ -1891,10 +1846,7 @@
 		    value = 1;
 		} else {
 		    leftuv = SvUVX(TOPm1s);
-		    if (leftuv > (UV) IV_MAX) {
-			/* As (b) is an IV, it cannot be > IV_MAX */
-			value = 1;
-		    } else if (leftuv > (UV)rightiv) {
+		    if (leftuv > (UV)rightiv) {
 			value = 1;
 		    } else if (leftuv < (UV)rightiv) {
 			value = -1;
@@ -1912,12 +1864,9 @@
 		    value = -1;
 		} else {
 		    rightuv = SvUVX(TOPs);
-		    if (rightuv > (UV) IV_MAX) {
-			/* As (a) is an IV, it cannot be > IV_MAX */
-			value = -1;
-		    } else if (leftiv > (UV)rightuv) {
+		    if ((UV)leftiv > rightuv) {
 			value = 1;
-		    } else if (leftiv < (UV)rightuv) {
+		    } else if ((UV)leftiv < rightuv) {
 			value = -1;
 		    } else {
 			value = 0;

Thread Next


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