diff options
-rw-r--r-- | libspeexdsp/fixed_debug.h | 4 | ||||
-rw-r--r-- | libspeexdsp/fixed_generic.h | 6 |
2 files changed, 5 insertions, 5 deletions
diff --git a/libspeexdsp/fixed_debug.h b/libspeexdsp/fixed_debug.h index 8b2f2ef..25d4ea7 100644 --- a/libspeexdsp/fixed_debug.h +++ b/libspeexdsp/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)>=(EXTEND32(1)<<(15+Q))) + if (ABS(b)>>(16+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,7 +295,7 @@ 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)>=(EXTEND32(1)<<(15+Q))) + if (ABS(b)>>(16+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) + ((EXTEND32(1)<<Q)>>1))>> Q; if (!VERIFY_INT(res)) diff --git a/libspeexdsp/fixed_generic.h b/libspeexdsp/fixed_generic.h index 64f65be..e5d1ce5 100644 --- a/libspeexdsp/fixed_generic.h +++ b/libspeexdsp/fixed_generic.h @@ -76,9 +76,9 @@ #define MAC16_16(c,a,b) (ADD32((c),MULT16_16((a),(b)))) -#define MULT16_32_P15(a,b) ADD32(MULT16_16((a),SHR((b),15)), PSHR(MULT16_16((a),((b)&0x00007fff)),15)) -#define MULT16_32_Q15(a,b) ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15)) -#define MAC16_32_Q15(c,a,b) ADD32(c,ADD32(MULT16_16((a),SHR((b),15)), SHR(MULT16_16((a),((b)&0x00007fff)),15))) +#define MULT16_32_P15(a,b) ADD32((a)*SHR((b),15), PSHR(MULT16_16((a),((b)&0x00007fff)),15)) +#define MULT16_32_Q15(a,b) ADD32((a)*SHR((b),15), SHR(MULT16_16((a),((b)&0x00007fff)),15)) +#define MAC16_32_Q15(c,a,b) ADD32(c,ADD32((a)*SHR((b),15), SHR(MULT16_16((a),((b)&0x00007fff)),15))) #define MAC16_16_Q11(c,a,b) (ADD32((c),SHR(MULT16_16((a),(b)),11))) |