aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2023-07-07 20:01:19 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2023-07-07 20:01:19 +0000
commit9ac841e922da86d4259add8bf64467f693b4f8aa (patch)
tree14663a8cd5dc19198fd3849c40c79f6741b4570c
parentaa8567656e7c2acf5a9e436195ba5dc47f279ac6 (diff)
downloadsrc-9ac841e922da86d4259add8bf64467f693b4f8aa.tar.gz
src-9ac841e922da86d4259add8bf64467f693b4f8aa.zip
divmoddi*: Use separate statements instead of the comma operator.
Differential Revision: https://reviews.freebsd.org/D40835
-rw-r--r--sys/libkern/divdi3.c18
-rw-r--r--sys/libkern/divmoddi4.c20
-rw-r--r--sys/libkern/moddi3.c11
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