shithub: riscv

Download patch

ref: a8834acf73c4c5bfa337fd3fb1ffc82151423a54
parent: ed2b1d5c610f0ff2d49780f69b6343d22f878a63
author: Michael Forney <mforney@mforney.org>
date: Sat Jan 23 13:26:34 EST 2021

[9front] cc: remove unnecessary 128-bit add function
Instead, just change the comparisons from <=/>= to </>.

--- a/sys/src/cmd/cc/com.c
+++ b/sys/src/cmd/cc/com.c
@@ -1360,19 +1360,6 @@
 	}
 	return 0;
 }
-static Big
-add(Big x, int y)
-{
-	uvlong ob;
-	
-	ob = x.b;
-	x.b += y;
-	if(y > 0 && x.b < ob)
-		x.a++;
-	if(y < 0 && x.b > ob)
-		x.a--;
-	return x;
-} 
 
 Big
 big(vlong a, uvlong b)
@@ -1468,7 +1455,7 @@
 	case OHS:
 		if(cmp(x, lo) <= 0)
 			goto useless;
-		if(cmp(x, add(hi, 1)) >= 0)
+		if(cmp(x, hi) > 0)
 			goto useless;
 		break;
 	case OLE:
@@ -1475,7 +1462,7 @@
 	case OLS:
 	case OGT:
 	case OHI:
-		if(cmp(x, add(lo, -1)) <= 0)
+		if(cmp(x, lo) < 0)
 			goto useless;
 		if(cmp(x, hi) >= 0)
 			goto useless;