Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.sbin/timed/timed Explicitly cast the long->float convers...



details:   https://anonhg.NetBSD.org/src/rev/f54040c3fba8
branches:  trunk
changeset: 989883:f54040c3fba8
user:      christos <christos%NetBSD.org@localhost>
date:      Mon Oct 18 14:16:49 2021 +0000

description:
Explicitly cast the long->float conversion since it is value-changing and
produces clang warnings.

diffstat:

 usr.sbin/timed/timed/networkdelta.c |  12 ++++++------
 1 files changed, 6 insertions(+), 6 deletions(-)

diffs (40 lines):

diff -r c6a36c54888c -r f54040c3fba8 usr.sbin/timed/timed/networkdelta.c
--- a/usr.sbin/timed/timed/networkdelta.c       Mon Oct 18 14:14:07 2021 +0000
+++ b/usr.sbin/timed/timed/networkdelta.c       Mon Oct 18 14:16:49 2021 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: networkdelta.c,v 1.12 2003/08/07 11:25:46 agc Exp $    */
+/*     $NetBSD: networkdelta.c,v 1.13 2021/10/18 14:16:49 christos Exp $       */
 
 /*-
  * Copyright (c) 1985, 1993 The Regents of the University of California.
@@ -34,7 +34,7 @@
 #if 0
 static char sccsid[] = "@(#)networkdelta.c     8.3 (Berkeley) 4/27/95";
 #else
-__RCSID("$NetBSD: networkdelta.c,v 1.12 2003/08/07 11:25:46 agc Exp $");
+__RCSID("$NetBSD: networkdelta.c,v 1.13 2021/10/18 14:16:49 christos Exp $");
 #endif
 #endif /* not lint */
 
@@ -157,8 +157,8 @@
        unsigned int gnuf)              /* good enough estimate */
 {
        long *xptr;
-       float ap = LONG_MAX;            /* bounds on the median */
-       float am = -LONG_MAX;
+       float ap = (float)LONG_MAX;     /* bounds on the median */
+       float am = (float)-LONG_MAX;
        float aa;
        int npts;                       /* # of points above & below guess */
        float xp;                       /* closet point above the guess */
@@ -180,8 +180,8 @@
                sum = 0.0;
                sumx = 0.0;
                npts = 0;
-               xp = LONG_MAX;
-               xm = -LONG_MAX;
+               xp = (float)LONG_MAX;
+               xm = (float)-LONG_MAX;
 
                for (xptr = x; xptr != xlim; xptr++) {
                        float xx = *xptr;



Home | Main Index | Thread Index | Old Index