Skip to content
Snippets Groups Projects
Verified Commit d633f523 authored by Mark Harris's avatar Mark Harris
Browse files

Fix float-approx negative left shift UB

Reported by toto.
parent 794392ec
No related branches found
No related tags found
No related merge requests found
......@@ -137,7 +137,7 @@ static OPUS_INLINE float celt_log2(float x)
} in;
in.f = x;
integer = (in.i>>23)-127;
in.i -= integer<<23;
in.i -= (opus_uint32)integer<<23;
frac = in.f - 1.5f;
frac = -0.41445418f + frac*(0.95909232f
+ frac*(-0.33951290f + frac*0.16541097f));
......@@ -160,7 +160,7 @@ static OPUS_INLINE float celt_exp2(float x)
/* K0 = 1, K1 = log(2), K2 = 3-4*log(2), K3 = 3*log(2) - 2 */
res.f = 0.99992522f + frac * (0.69583354f
+ frac * (0.22606716f + 0.078024523f*frac));
res.i = (res.i + (integer<<23)) & 0x7fffffff;
res.i = (res.i + ((opus_uint32)integer<<23)) & 0x7fffffff;
return res.f;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment