Module Name: src
Committed By: rillig
Date: Sat Aug 28 15:36:54 UTC 2021
Modified Files:
src/usr.bin/xlint/lint1: tree.c
Log Message:
lint: merge duplicate code in convert_constant_floating
To generate a diff of this commit:
cvs rdiff -u -r1.356 -r1.357 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.356 src/usr.bin/xlint/lint1/tree.c:1.357
--- src/usr.bin/xlint/lint1/tree.c:1.356 Sat Aug 28 13:11:10 2021
+++ src/usr.bin/xlint/lint1/tree.c Sat Aug 28 15:36:54 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: tree.c,v 1.356 2021/08/28 13:11:10 rillig Exp $ */
+/* $NetBSD: tree.c,v 1.357 2021/08/28 15:36:54 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.356 2021/08/28 13:11:10 rillig Exp $");
+__RCSID("$NetBSD: tree.c,v 1.357 2021/08/28 15:36:54 rillig Exp $");
#endif
#include <float.h>
@@ -2251,6 +2251,7 @@ convert_constant_floating(op_t op, int a
}
v->v_ldbl = v->v_ldbl > 0 ? max : min;
}
+
if (nt == FLOAT) {
nv->v_ldbl = (float)v->v_ldbl;
} else if (nt == DOUBLE) {
@@ -2258,8 +2259,7 @@ convert_constant_floating(op_t op, int a
} else if (nt == LDOUBLE) {
nv->v_ldbl = v->v_ldbl;
} else {
- nv->v_quad = (nt == PTR || is_uinteger(nt)) ?
- (int64_t)v->v_ldbl : (int64_t)v->v_ldbl;
+ nv->v_quad = (int64_t)v->v_ldbl;
}
}