From 1f947e30b76f38b245ad8eb0af8005910b8fb08e Mon Sep 17 00:00:00 2001 From: tb Date: Fri, 28 May 2021 15:16:43 +0000 Subject: [PATCH] Silence a clang warning on loss of precision When converting a long or long long to a double, there may be loss of precision and clang >= 10 warns about this unless there is a cast. Add casts to silence this warning - the code is designed to handle precisely this loss of precision, so this is harmless. From CheriBSD via FreeBSD ok millert --- lib/libm/src/s_lroundl.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/libm/src/s_lroundl.c b/lib/libm/src/s_lroundl.c index d0264b31327..c101cd18df4 100644 --- a/lib/libm/src/s_lroundl.c +++ b/lib/libm/src/s_lroundl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_lroundl.c,v 1.3 2019/03/15 05:42:38 kevlo Exp $ */ +/* $OpenBSD: s_lroundl.c,v 1.4 2021/05/28 15:16:43 tb Exp $ */ /*- * Copyright (c) 2005 David Schultz @@ -47,9 +47,9 @@ * that everything is in range. At compile time, INRANGE(x) should reduce to * two floating-point comparisons in the former case, or TRUE otherwise. */ -static const type dtype_min = DTYPE_MIN - 0.5; -static const type dtype_max = DTYPE_MAX + 0.5; -#define INRANGE(x) (dtype_max - DTYPE_MAX != 0.5 || \ +static const type dtype_min = (type)DTYPE_MIN - 0.5; +static const type dtype_max = (type)DTYPE_MAX + 0.5; +#define INRANGE(x) (dtype_max - (type)DTYPE_MAX != 0.5 || \ ((x) > dtype_min && (x) < dtype_max)) dtype -- 2.20.1