9front - general discussion about 9front
 help / color / mirror / Atom feed
* [9front] cc: remove unnecessary 128-bit add function
@ 2021-01-20 10:57 Michael Forney
  0 siblings, 0 replies; only message in thread
From: Michael Forney @ 2021-01-20 10:57 UTC (permalink / raw)
  To: 9front

Instead, just change the comparisons from <=/>= to </>.

diff -r 11c719e3c471 -r de216620e3ab sys/src/cmd/cc/com.c
--- a/sys/src/cmd/cc/com.c	Wed Jan 20 01:29:03 2021 -0800
+++ b/sys/src/cmd/cc/com.c	Wed Jan 20 01:38:46 2021 -0800
@@ -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,14 +1455,14 @@
 	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:
 	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;

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-20 11:24 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-20 10:57 [9front] cc: remove unnecessary 128-bit add function Michael Forney

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).