[xiph-commits] r14447 - trunk/speex/libspeex
jm at svn.xiph.org
jm at svn.xiph.org
Fri Feb 1 21:29:46 PST 2008
Author: jm
Date: 2008-02-01 21:29:40 -0800 (Fri, 01 Feb 2008)
New Revision: 14447
Modified:
trunk/speex/libspeex/fixed_debug.h
trunk/speex/libspeex/fixed_generic.h
Log:
Fix for 1<<shift on TI C5x for shift>15 (thanks to Jim Crichton)
Modified: trunk/speex/libspeex/fixed_debug.h
===================================================================
--- trunk/speex/libspeex/fixed_debug.h 2008-02-02 05:11:39 UTC (rev 14446)
+++ trunk/speex/libspeex/fixed_debug.h 2008-02-02 05:29:40 UTC (rev 14447)
@@ -279,7 +279,7 @@
{
fprintf (stderr, "MULT16_32_Q%d: inputs are not short+int: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
}
- if (ABS32(b)>=(1<<(15+Q)))
+ if (ABS32(b)>=(EXTEND32(1)<<(15+Q)))
fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d in %s: line %d\n", Q, (int)a, (int)b, file, line);
res = (((long long)a)*(long long)b) >> Q;
if (!VERIFY_INT(res))
@@ -295,9 +295,9 @@
{
fprintf (stderr, "MULT16_32_P%d: inputs are not short+int: %d %d\n", Q, (int)a, (int)b);
}
- if (ABS32(b)>=(1<<(15+Q)))
+ if (ABS32(b)>=(EXTEND32(1)<<(15+Q)))
fprintf (stderr, "MULT16_32_Q%d: second operand too large: %d %d\n", Q, (int)a, (int)b);
- res = ((((long long)a)*(long long)b) + ((1<<Q)>>1))>> Q;
+ res = ((((long long)a)*(long long)b) + ((EXTEND32(1)<<Q)>>1))>> Q;
if (!VERIFY_INT(res))
fprintf (stderr, "MULT16_32_P%d: output is not int: %d*%d=%d\n", Q, (int)a, (int)b,(int)res);
spx_mips+=5;
Modified: trunk/speex/libspeex/fixed_generic.h
===================================================================
--- trunk/speex/libspeex/fixed_generic.h 2008-02-02 05:11:39 UTC (rev 14446)
+++ trunk/speex/libspeex/fixed_generic.h 2008-02-02 05:29:40 UTC (rev 14447)
@@ -54,7 +54,7 @@
#define SHR(a,shift) ((a) >> (shift))
#define SHL(a,shift) ((spx_word32_t)(a) << (shift))
-#define PSHR(a,shift) (SHR((a)+((1<<((shift))>>1)),shift))
+#define PSHR(a,shift) (SHR((a)+((EXTEND32(1)<<((shift))>>1)),shift))
#define SATURATE(x,a) (((x)>(a) ? (a) : (x)<-(a) ? -(a) : (x)))
More information about the commits
mailing list