9front - general discussion about 9front
 help / color / mirror / Atom feed
From: Michael Forney <mforney@mforney.org>
To: 9front@9front.org
Subject: [9front] cc: remove unnecessary 128-bit add function
Date: Wed, 20 Jan 2021 02:57:02 -0800	[thread overview]
Message-ID: <9ECB0CAF455CBF181F28D3BDE6ED5D35@arrow.hsd1.ca.comcast.net> (raw)

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;

                 reply	other threads:[~2021-01-20 11:24 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9ECB0CAF455CBF181F28D3BDE6ED5D35@arrow.hsd1.ca.comcast.net \
    --to=mforney@mforney.org \
    --cc=9front@9front.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).