commit | c3273ed7e79045183281d1d80a6b6b86839d197d | [log] [tgz] |
---|---|---|
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | Thu Nov 29 16:51:06 2012 -0500 |
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | Thu Nov 29 16:51:50 2012 -0500 |
tree | a8724a3f90a150e4bbe03623048c0957c0dc6165 | |
parent | e0491e7d18038b4bcd21c290dae51dfe019977ef [diff] [blame] |
Fixes an overflow in the fixed-point celt_sqrt() for large values. Was causing problems with the PLC
diff --git a/celt/mathops.c b/celt/mathops.c index ce472c9..21fd942 100644 --- a/celt/mathops.c +++ b/celt/mathops.c
@@ -123,6 +123,8 @@ static const opus_val16 C[5] = {23175, 11561, -3011, 1699, -664}; if (x==0) return 0; + else if (x>=1073741824) + return 32767; k = (celt_ilog2(x)>>1)-7; x = VSHR32(x, 2*k); n = x-32768;