Source-Changes-HG archive

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

[src/trunk]: src/lib/libm/src ifdef out some dead code. improves code readabi...



details:   https://anonhg.NetBSD.org/src/rev/67635f7b50a9
branches:  trunk
changeset: 821582:67635f7b50a9
user:      maya <maya%NetBSD.org@localhost>
date:      Thu Feb 09 22:11:09 2017 +0000

description:
ifdef out some dead code. improves code readability.
all later users of y first assign another value.

using ifdefs to make potential future code syncs easier, as is done
elsewhere.

suggested by coverity, CID 1300929, 1300930.

diffstat:

 lib/libm/src/s_expm1.c  |  4 +++-
 lib/libm/src/s_expm1f.c |  4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diffs (44 lines):

diff -r 15eee15e4814 -r 67635f7b50a9 lib/libm/src/s_expm1.c
--- a/lib/libm/src/s_expm1.c    Thu Feb 09 22:02:13 2017 +0000
+++ b/lib/libm/src/s_expm1.c    Thu Feb 09 22:11:09 2017 +0000
@@ -12,7 +12,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_expm1.c,v 1.12 2002/05/26 22:01:55 wiz Exp $");
+__RCSID("$NetBSD: s_expm1.c,v 1.13 2017/02/09 22:11:09 maya Exp $");
 #endif
 
 /* expm1(x)
@@ -138,7 +138,9 @@
        c = 0;
        GET_HIGH_WORD(hx,x);
        xsb = hx&0x80000000;            /* sign bit of x */
+#ifdef DEAD_CODE
        if(xsb==0) y=x; else y= -x;     /* y = |x| */
+#endif
        hx &= 0x7fffffff;               /* high word of |x| */
 
     /* filter out huge and non-finite argument */
diff -r 15eee15e4814 -r 67635f7b50a9 lib/libm/src/s_expm1f.c
--- a/lib/libm/src/s_expm1f.c   Thu Feb 09 22:02:13 2017 +0000
+++ b/lib/libm/src/s_expm1f.c   Thu Feb 09 22:11:09 2017 +0000
@@ -15,7 +15,7 @@
 
 #include <sys/cdefs.h>
 #if defined(LIBM_SCCS) && !defined(lint)
-__RCSID("$NetBSD: s_expm1f.c,v 1.10 2002/05/26 22:01:55 wiz Exp $");
+__RCSID("$NetBSD: s_expm1f.c,v 1.11 2017/02/09 22:11:09 maya Exp $");
 #endif
 
 #include "math.h"
@@ -46,7 +46,9 @@
        c = 0;
        GET_FLOAT_WORD(hx,x);
        xsb = hx&0x80000000;            /* sign bit of x */
+#ifdef DEAD_CODE
        if(xsb==0) y=x; else y= -x;     /* y = |x| */
+#endif
        hx &= 0x7fffffff;               /* high word of |x| */
 
     /* filter out huge and non-finite argument */



Home | Main Index | Thread Index | Old Index