diff options
author | 2015-08-20 19:24:58 +0000 | |
---|---|---|
committer | 2015-08-20 19:24:58 +0000 | |
commit | 3ab668d4da0655f3f5d14303f19de76c559f5176 (patch) | |
tree | 4162bfae9da6211ede76da1a0c9f0946e669467f /lib/libm/src | |
parent | In the certificates section, be consistent about using "host_key" (diff) | |
download | wireguard-openbsd-3ab668d4da0655f3f5d14303f19de76c559f5176.tar.xz wireguard-openbsd-3ab668d4da0655f3f5d14303f19de76c559f5176.zip |
Avoid left-shifting a negative integer, which is undefined. Replace
it with the intended value, in a defined way. From FreeBSD (Dimitry Andric).
ok miod@ deraadt@ kettenis@
Diffstat (limited to 'lib/libm/src')
-rw-r--r-- | lib/libm/src/s_exp2.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/libm/src/s_exp2.c b/lib/libm/src/s_exp2.c index f752a6d03de..c28b7c44285 100644 --- a/lib/libm/src/s_exp2.c +++ b/lib/libm/src/s_exp2.c @@ -1,4 +1,4 @@ -/* $OpenBSD: s_exp2.c,v 1.7 2013/07/03 04:46:36 espie Exp $ */ +/* $OpenBSD: s_exp2.c,v 1.8 2015/08/20 19:24:58 naddy Exp $ */ /*- * Copyright (c) 2005 David Schultz <das@FreeBSD.ORG> * All rights reserved. @@ -373,14 +373,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); |