Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/xlint/lint1 lint: make overflow check for binary '+'...
details: https://anonhg.NetBSD.org/src/rev/b0d2815f2c97
branches: trunk
changeset: 1023090:b0d2815f2c97
user: rillig <rillig%NetBSD.org@localhost>
date: Mon Aug 23 06:32:30 2021 +0000
description:
lint: make overflow check for binary '+' simpler
No functional change.
diffstat:
usr.bin/xlint/lint1/tree.c | 15 ++++++---------
1 files changed, 6 insertions(+), 9 deletions(-)
diffs (36 lines):
diff -r 7ef78cec4045 -r b0d2815f2c97 usr.bin/xlint/lint1/tree.c
--- a/usr.bin/xlint/lint1/tree.c Mon Aug 23 06:26:37 2021 +0000
+++ b/usr.bin/xlint/lint1/tree.c Mon Aug 23 06:32:30 2021 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.348 2021/08/23 06:21:59 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.349 2021/08/23 06:32:30 rillig Exp $ */
/*
* Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
#include <sys/cdefs.h>
#if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: tree.c,v 1.348 2021/08/23 06:21:59 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.349 2021/08/23 06:32:30 rillig Exp $");
#endif
#include <float.h>
@@ -3084,13 +3084,10 @@
break;
case PLUS:
q = utyp ? (int64_t)(ul + ur) : sl + sr;
- if (msb(sl, t) && msb(sr, t)) {
- if (!msb(q, t))
- ovfl = true;
- } else if (!msb(sl, t) && !msb(sr, t)) {
- if (msb(q, t) && !utyp)
- ovfl = true;
- }
+ if (msb(sl, t) && msb(sr, t) && !msb(q, t))
+ ovfl = true;
+ if (!utyp && !msb(sl, t) && !msb(sr, t) && msb(q, t))
+ ovfl = true;
break;
case MINUS:
q = utyp ? (int64_t)(ul - ur) : sl - sr;
Home |
Main Index |
Thread Index |
Old Index