Module Name: src
Committed By: rillig
Date: Mon Aug 23 06:32:31 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: tree.c
Log Message:
lint: make overflow check for binary '+' simpler
No functional change.
To generate a diff of this commit:
cvs rdiff -u -r1.348 -r1.349 src/usr.bin/xlint/lint1/tree.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/usr.bin/xlint/lint1/tree.c
diff -u src/usr.bin/xlint/lint1/tree.c:1.348 src/usr.bin/xlint/lint1/tree.c:1.349
--- src/usr.bin/xlint/lint1/tree.c:1.348 Mon Aug 23 06:21:59 2021
+++ src/usr.bin/xlint/lint1/tree.c Mon Aug 23 06:32:30 2021
@@ -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 @@ fold(tnode_t *tn)
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;