diff options
author | jm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800> | 2008-02-02 08:29:40 +0300 |
---|---|---|
committer | jm <jm@0101bb08-14d6-0310-b084-bc0e0c8e3800> | 2008-02-02 08:29:40 +0300 |
commit | e33e0f4c02718812baa4b780333b911aae6af67a (patch) | |
tree | ebfedf535b5bf60312566439d560cc67fefabe05 | |
parent | c0924f60f3dc44116f08ae2a1db64802e9390a58 (diff) |
Fix for 1<<shift on TI C5x for shift>15 (thanks to Jim Crichton)
git-svn-id: http://svn.xiph.org/trunk/speex@14447 0101bb08-14d6-0310-b084-bc0e0c8e3800
-rw-r--r-- | libspeex/fixed_debug.h | 6 | ||||
-rw-r--r-- | libspeex/fixed_generic.h | 2 |
2 files changed, 4 insertions, 4 deletions
diff --git a/libspeex/fixed_debug.h b/libspeex/fixed_debug.h index 472a4e4..54f3866 100644 --- a/libspeex/fixed_debug.h +++ b/libspeex/fixed_debug.h @@ -279,7 +279,7 @@ static inline int _MULT16_32_QX(int a, long long b, int Q, char *file, int line) { 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 @@ static inline int MULT16_32_PX(int a, long long b, int Q) { 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; diff --git a/libspeex/fixed_generic.h b/libspeex/fixed_generic.h index c9b2a0b..3fb096e 100644 --- a/libspeex/fixed_generic.h +++ b/libspeex/fixed_generic.h @@ -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))) |