Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 7 Jul 2023 20:01:33 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 9ac841e922da - main - divmoddi*: Use separate statements instead of the comma operator.
Message-ID:  <202307072001.367K1XoU024140@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by jhb:

URL: https://cgit.FreeBSD.org/src/commit/?id=9ac841e922da86d4259add8bf64467f693b4f8aa

commit 9ac841e922da86d4259add8bf64467f693b4f8aa
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2023-07-07 20:01:19 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2023-07-07 20:01:19 +0000

    divmoddi*: Use separate statements instead of the comma operator.
    
    Differential Revision:  https://reviews.freebsd.org/D40835
---
 sys/libkern/divdi3.c    | 18 +++++++++++-------
 sys/libkern/divmoddi4.c | 20 +++++++++++++-------
 sys/libkern/moddi3.c    | 11 +++++++----
 3 files changed, 31 insertions(+), 18 deletions(-)

diff --git a/sys/libkern/divdi3.c b/sys/libkern/divdi3.c
index 8e04a81abdba..5800388a8704 100644
--- a/sys/libkern/divdi3.c
+++ b/sys/libkern/divdi3.c
@@ -47,13 +47,17 @@ __divdi3(quad_t a, quad_t b)
 	u_quad_t ua, ub, uq;
 	int neg;
 
-	if (a < 0)
-		ua = -(u_quad_t)a, neg = 1;
-	else
-		ua = a, neg = 0;
-	if (b < 0)
-		ub = -(u_quad_t)b, neg ^= 1;
-	else
+	if (a < 0) {
+		ua = -(u_quad_t)a;
+		neg = 1;
+	} else {
+		ua = a;
+		neg = 0;
+	}
+	if (b < 0) {
+		ub = -(u_quad_t)b;
+		neg ^= 1;
+	} else
 		ub = b;
 	uq = __qdivrem(ua, ub, (u_quad_t *)0);
 	return (neg ? -uq : uq);
diff --git a/sys/libkern/divmoddi4.c b/sys/libkern/divmoddi4.c
index af0013532882..67a95b82d24b 100644
--- a/sys/libkern/divmoddi4.c
+++ b/sys/libkern/divmoddi4.c
@@ -44,13 +44,19 @@ __divmoddi4(quad_t a, quad_t b, quad_t *rem)
 	u_quad_t ua, ub, uq, urem;
 	int negq, negr;
 
-	if (a < 0)
-		ua = -(u_quad_t)a, negq = 1, negr = 1;
-	else
-		ua = a, negq = 0, negr = 0;
-	if (b < 0)
-		ub = -(u_quad_t)b, negq ^= 1;
-	else
+	if (a < 0) {
+		ua = -(u_quad_t)a;
+		negq = 1;
+		negr = 1;
+	} else {
+		ua = a;
+		negq = 0;
+		negr = 0;
+	}
+	if (b < 0) {
+		ub = -(u_quad_t)b;
+		negq ^= 1;
+	} else
 		ub = b;
 	uq = __qdivrem(ua, ub, &urem);
 	if (rem != 0)
diff --git a/sys/libkern/moddi3.c b/sys/libkern/moddi3.c
index 0dbff4bdce89..60c3a85bb6e7 100644
--- a/sys/libkern/moddi3.c
+++ b/sys/libkern/moddi3.c
@@ -47,10 +47,13 @@ __moddi3(quad_t a, quad_t b)
 	u_quad_t ua, ub, ur;
 	int neg;
 
-	if (a < 0)
-		ua = -(u_quad_t)a, neg = 1;
-	else
-		ua = a, neg = 0;
+	if (a < 0) {
+		ua = -(u_quad_t)a;
+		neg = 1;
+	} else {
+		ua = a;
+		neg = 0;
+	}
 	if (b < 0)
 		ub = -(u_quad_t)b;
 	else



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202307072001.367K1XoU024140>