Skip to content

Commit 62c7361

Browse files
committed
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.
1 parent 78c0afb commit 62c7361

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/s_exp2.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -375,14 +375,14 @@ exp2(double x)
375375
/* Compute r = exp2(y) = exp2t[i0] * p(z - eps[i]). */
376376
t = tbl[i0]; /* exp2t[i0] */
377377
z -= tbl[i0 + 1]; /* eps[i0] */
378-
if (k >= -1021 << 20)
378+
if (k >= -(1021 << 20))
379379
INSERT_WORDS(twopk, 0x3ff00000 + k, 0);
380380
else
381381
INSERT_WORDS(twopkp1000, 0x3ff00000 + k + (1000 << 20), 0);
382382
r = t + t * z * (P1 + z * (P2 + z * (P3 + z * (P4 + z * P5))));
383383

384384
/* Scale by 2**(k>>20). */
385-
if(k >= -1021 << 20) {
385+
if(k >= -(1021 << 20)) {
386386
if (k == 1024 << 20)
387387
return (r * 2.0 * 0x1p1023);
388388
return (r * twopk);

0 commit comments

Comments
 (0)