From 29eae1023255abe012d63680adfc3bdef2a32dde Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Mon, 11 Jul 2016 13:53:31 -0600 Subject: [PATCH] lib_expi/f(): Exponental table should be 'const'. Dimension was wrong for float version. --- libc/math/lib_libexpi.c | 4 ++-- libc/math/lib_libexpif.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libc/math/lib_libexpi.c b/libc/math/lib_libexpi.c index c6f8341ae4..cab07ca8fa 100644 --- a/libc/math/lib_libexpi.c +++ b/libc/math/lib_libexpi.c @@ -58,7 +58,7 @@ * Private Data ****************************************************************************/ -static double g_expi_square_tbl[11] = +static const double g_expi_square_tbl[11] = { M_E, /* e^1 */ M_E2, /* e^2 */ @@ -91,7 +91,7 @@ double lib_expi(size_t n) for (i = 0; n; i++) { - if (n & (1 << i)) + if ((n & (1 << i)) != 0) { n &= ~(1 << i); val *= g_expi_square_tbl[i]; diff --git a/libc/math/lib_libexpif.c b/libc/math/lib_libexpif.c index 8d8509c723..d1204d2127 100644 --- a/libc/math/lib_libexpif.c +++ b/libc/math/lib_libexpif.c @@ -55,7 +55,7 @@ * Private Data ****************************************************************************/ -static float g_expif_square_tbl[11] = +static const float g_expif_square_tbl[8] = { (float)M_E, /* e^1 */ (float)M_E2, /* e^2 */ @@ -85,7 +85,7 @@ float lib_expif(size_t n) for (i = 0; n; i++) { - if (n & (1 << i)) + if ((n & (1 << i)) != 0) { n &= ~(1 << i); val *= g_expif_square_tbl[i];