From 62c7361aab5c64376e39f4ce50d2d045caef37d6 Mon Sep 17 00:00:00 2001 From: Ed Schouten Date: Sat, 27 Feb 2016 17:27:55 +0100 Subject: [PATCH] Suppress a compiler warning generated by Clang. Clang doesn't like it if you bitshift negative numbers, as the behaviour of it is undefined. Solve this by first shifting, followed by negating. This was fixed similarly in FreeBSD. --- src/s_exp2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/s_exp2.c b/src/s_exp2.c index 7de2f24..023657c 100644 --- a/src/s_exp2.c +++ b/src/s_exp2.c @@ -375,14 +375,14 @@ exp2(double x) /* Compute r = exp2(y) = exp2t[i0] * p(z - eps[i]). */ t = tbl[i0]; /* exp2t[i0] */ z -= tbl[i0 + 1]; /* eps[i0] */ - if (k >= -1021 << 20) + if (k >= -(1021 << 20)) INSERT_WORDS(twopk, 0x3ff00000 + k, 0); else INSERT_WORDS(twopkp1000, 0x3ff00000 + k + (1000 << 20), 0); r = t + t * z * (P1 + z * (P2 + z * (P3 + z * (P4 + z * P5)))); /* Scale by 2**(k>>20). */ - if(k >= -1021 << 20) { + if(k >= -(1021 << 20)) { if (k == 1024 << 20) return (r * 2.0 * 0x1p1023); return (r * twopk);