diff options
Diffstat (limited to 'silk/MacroDebug.h')
-rw-r--r-- | silk/MacroDebug.h | 101 |
1 files changed, 59 insertions, 42 deletions
diff --git a/silk/MacroDebug.h b/silk/MacroDebug.h index 89f7f31d..e407b808 100644 --- a/silk/MacroDebug.h +++ b/silk/MacroDebug.h @@ -33,7 +33,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #if 0 && defined (_DEBUG) && !defined (silk_MACRO_COUNT) -#undef silk_ADD16 +#undef silk_ADD16 static inline opus_int16 silk_ADD16(opus_int16 a, opus_int16 b){ opus_int16 ret; @@ -42,7 +42,7 @@ static inline opus_int16 silk_ADD16(opus_int16 a, opus_int16 b){ return ret; } -#undef silk_ADD32 +#undef silk_ADD32 static inline opus_int32 silk_ADD32(opus_int32 a, opus_int32 b){ opus_int32 ret; @@ -51,7 +51,7 @@ static inline opus_int32 silk_ADD32(opus_int32 a, opus_int32 b){ return ret; } -#undef silk_ADD64 +#undef silk_ADD64 static inline opus_int64 silk_ADD64(opus_int64 a, opus_int64 b){ opus_int64 ret; @@ -60,7 +60,7 @@ static inline opus_int64 silk_ADD64(opus_int64 a, opus_int64 b){ return ret; } -#undef silk_SUB16 +#undef silk_SUB16 static inline opus_int16 silk_SUB16(opus_int16 a, opus_int16 b){ opus_int16 ret; @@ -69,7 +69,7 @@ static inline opus_int16 silk_SUB16(opus_int16 a, opus_int16 b){ return ret; } -#undef silk_SUB32 +#undef silk_SUB32 static inline opus_int32 silk_SUB32(opus_int32 a, opus_int32 b){ opus_int32 ret; @@ -78,7 +78,7 @@ static inline opus_int32 silk_SUB32(opus_int32 a, opus_int32 b){ return ret; } -#undef silk_SUB64 +#undef silk_SUB64 static inline opus_int64 silk_SUB64(opus_int64 a, opus_int64 b){ opus_int64 ret; @@ -175,6 +175,7 @@ static inline opus_uint32 silk_MUL_uint(opus_uint32 a32, opus_uint32 b32){ silk_assert((opus_uint64)ret == (opus_uint64)a32 * (opus_uint64)b32); /* Check output overflow */ return ret; } + #undef silk_MLA static inline opus_int32 silk_MLA(opus_int32 a32, opus_int32 b32, opus_int32 c32){ opus_int32 ret; @@ -191,14 +192,15 @@ static inline opus_int32 silk_MLA_uint(opus_uint32 a32, opus_uint32 b32, opus_ui return ret; } -#undef silk_SMULWB +#undef silk_SMULWB static inline opus_int32 silk_SMULWB(opus_int32 a32, opus_int32 b32){ opus_int32 ret; ret = (a32 >> 16) * (opus_int32)((opus_int16)b32) + (((a32 & 0x0000FFFF) * (opus_int32)((opus_int16)b32)) >> 16); silk_assert((opus_int64)ret == ((opus_int64)a32 * (opus_int16)b32) >> 16); return ret; } -#undef silk_SMLAWB + +#undef silk_SMLAWB static inline opus_int32 silk_SMLAWB(opus_int32 a32, opus_int32 b32, opus_int32 c32){ opus_int32 ret; ret = silk_ADD32( a32, silk_SMULWB( b32, c32 ) ); @@ -213,6 +215,7 @@ static inline opus_int32 silk_SMULWT(opus_int32 a32, opus_int32 b32){ silk_assert((opus_int64)ret == ((opus_int64)a32 * (b32 >> 16)) >> 16); return ret; } + #undef silk_SMLAWT static inline opus_int32 silk_SMLAWT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ opus_int32 ret; @@ -234,7 +237,7 @@ static inline opus_int64 silk_SMULL(opus_int64 a64, opus_int64 b64){ } /* no checking needed for silk_SMULBB */ -#undef silk_SMLABB +#undef silk_SMLABB static inline opus_int32 silk_SMLABB(opus_int32 a32, opus_int32 b32, opus_int32 c32){ opus_int32 ret; ret = a32 + (opus_int32)((opus_int16)b32) * (opus_int32)((opus_int16)c32); @@ -243,7 +246,7 @@ static inline opus_int32 silk_SMLABB(opus_int32 a32, opus_int32 b32, opus_int32 } /* no checking needed for silk_SMULBT */ -#undef silk_SMLABT +#undef silk_SMLABT static inline opus_int32 silk_SMLABT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ opus_int32 ret; ret = a32 + ((opus_int32)((opus_int16)b32)) * (c32 >> 16); @@ -252,7 +255,7 @@ static inline opus_int32 silk_SMLABT(opus_int32 a32, opus_int32 b32, opus_int32 } /* no checking needed for silk_SMULTT */ -#undef silk_SMLATT +#undef silk_SMLATT static inline opus_int32 silk_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32 c32){ opus_int32 ret; ret = a32 + (b32 >> 16) * (c32 >> 16); @@ -260,7 +263,7 @@ static inline opus_int32 silk_SMLATT(opus_int32 a32, opus_int32 b32, opus_int32 return ret; } -#undef silk_SMULWW +#undef silk_SMULWW static inline opus_int32 silk_SMULWW(opus_int32 a32, opus_int32 b32){ opus_int32 ret, tmp1, tmp2; opus_int64 ret64; @@ -281,7 +284,7 @@ static inline opus_int32 silk_SMULWW(opus_int32 a32, opus_int32 b32){ return ret; } -#undef silk_SMLAWW +#undef silk_SMLAWW static inline opus_int32 silk_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32 c32){ opus_int32 ret, tmp; @@ -292,9 +295,9 @@ static inline opus_int32 silk_SMLAWW(opus_int32 a32, opus_int32 b32, opus_int32 } /* Multiply-accumulate macros that allow overflow in the addition (ie, no asserts in debug mode) */ -#undef silk_MLA_ovflw +#undef silk_MLA_ovflw #define silk_MLA_ovflw(a32, b32, c32) ((a32) + ((b32) * (c32))) -#undef silk_SMLABB_ovflw +#undef silk_SMLABB_ovflw #define silk_SMLABB_ovflw(a32, b32, c32) ((a32) + ((opus_int32)((opus_int16)(b32))) * (opus_int32)((opus_int16)(c32))) /* no checking needed for silk_SMULL @@ -325,7 +328,8 @@ static inline opus_int32 silk_DIV32_16(opus_int32 a32, opus_int32 b32){ no checking needed for silk_ADD_POS_SAT16 no checking needed for silk_ADD_POS_SAT32 no checking needed for silk_ADD_POS_SAT64 */ -#undef silk_LSHIFT8 + +#undef silk_LSHIFT8 static inline opus_int8 silk_LSHIFT8(opus_int8 a, opus_int32 shift){ opus_int8 ret; ret = a << shift; @@ -334,7 +338,8 @@ static inline opus_int8 silk_LSHIFT8(opus_int8 a, opus_int32 shift){ silk_assert((opus_int64)ret == ((opus_int64)a) << shift); return ret; } -#undef silk_LSHIFT16 + +#undef silk_LSHIFT16 static inline opus_int16 silk_LSHIFT16(opus_int16 a, opus_int32 shift){ opus_int16 ret; ret = a << shift; @@ -343,7 +348,8 @@ static inline opus_int16 silk_LSHIFT16(opus_int16 a, opus_int32 shift){ silk_assert((opus_int64)ret == ((opus_int64)a) << shift); return ret; } -#undef silk_LSHIFT32 + +#undef silk_LSHIFT32 static inline opus_int32 silk_LSHIFT32(opus_int32 a, opus_int32 shift){ opus_int32 ret; ret = a << shift; @@ -352,20 +358,21 @@ static inline opus_int32 silk_LSHIFT32(opus_int32 a, opus_int32 shift){ silk_assert((opus_int64)ret == ((opus_int64)a) << shift); return ret; } -#undef silk_LSHIFT64 + +#undef silk_LSHIFT64 static inline opus_int64 silk_LSHIFT64(opus_int64 a, opus_int shift){ silk_assert(shift >= 0); silk_assert(shift < 64); return a << shift; } -#undef silk_LSHIFT_ovflw +#undef silk_LSHIFT_ovflw static inline opus_int32 silk_LSHIFT_ovflw(opus_int32 a, opus_int32 shift){ silk_assert(shift >= 0); /* no check for overflow */ return a << shift; } -#undef silk_LSHIFT_uint +#undef silk_LSHIFT_uint static inline opus_uint32 silk_LSHIFT_uint(opus_uint32 a, opus_int32 shift){ opus_uint32 ret; ret = a << shift; @@ -374,39 +381,42 @@ static inline opus_uint32 silk_LSHIFT_uint(opus_uint32 a, opus_int32 shift){ return ret; } -#undef silk_RSHIFT8 +#undef silk_RSHIFT8 static inline opus_int8 silk_RSHIFT8(opus_int8 a, opus_int32 shift){ silk_assert(shift >= 0); silk_assert(shift < 8); return a >> shift; } -#undef silk_RSHIFT16 + +#undef silk_RSHIFT16 static inline opus_int16 silk_RSHIFT16(opus_int16 a, opus_int32 shift){ silk_assert(shift >= 0); silk_assert(shift < 16); return a >> shift; } -#undef silk_RSHIFT32 + +#undef silk_RSHIFT32 static inline opus_int32 silk_RSHIFT32(opus_int32 a, opus_int32 shift){ silk_assert(shift >= 0); silk_assert(shift < 32); return a >> shift; } -#undef silk_RSHIFT64 + +#undef silk_RSHIFT64 static inline opus_int64 silk_RSHIFT64(opus_int64 a, opus_int64 shift){ silk_assert(shift >= 0); silk_assert(shift <= 63); return a >> shift; } -#undef silk_RSHIFT_uint +#undef silk_RSHIFT_uint static inline opus_uint32 silk_RSHIFT_uint(opus_uint32 a, opus_int32 shift){ silk_assert(shift >= 0); silk_assert(shift <= 32); return a >> shift; } -#undef silk_ADD_LSHIFT +#undef silk_ADD_LSHIFT static inline opus_int32 silk_ADD_LSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){ opus_int32 ret; silk_assert(shift >= 0); @@ -415,7 +425,8 @@ static inline opus_int32 silk_ADD_LSHIFT(opus_int32 a, opus_int32 b, opus_int32 silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift)); return ret; /* shift >= 0 */ } -#undef silk_ADD_LSHIFT32 + +#undef silk_ADD_LSHIFT32 static inline opus_int32 silk_ADD_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ opus_int32 ret; silk_assert(shift >= 0); @@ -424,7 +435,8 @@ static inline opus_int32 silk_ADD_LSHIFT32(opus_int32 a, opus_int32 b, opus_int3 silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift)); return ret; /* shift >= 0 */ } -#undef silk_ADD_LSHIFT_uint + +#undef silk_ADD_LSHIFT_uint static inline opus_uint32 silk_ADD_LSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){ opus_uint32 ret; silk_assert(shift >= 0); @@ -433,7 +445,8 @@ static inline opus_uint32 silk_ADD_LSHIFT_uint(opus_uint32 a, opus_uint32 b, opu silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) << shift)); return ret; /* shift >= 0 */ } -#undef silk_ADD_RSHIFT + +#undef silk_ADD_RSHIFT static inline opus_int32 silk_ADD_RSHIFT(opus_int32 a, opus_int32 b, opus_int32 shift){ opus_int32 ret; silk_assert(shift >= 0); @@ -442,7 +455,8 @@ static inline opus_int32 silk_ADD_RSHIFT(opus_int32 a, opus_int32 b, opus_int32 silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift)); return ret; /* shift > 0 */ } -#undef silk_ADD_RSHIFT32 + +#undef silk_ADD_RSHIFT32 static inline opus_int32 silk_ADD_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ opus_int32 ret; silk_assert(shift >= 0); @@ -451,7 +465,8 @@ static inline opus_int32 silk_ADD_RSHIFT32(opus_int32 a, opus_int32 b, opus_int3 silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift)); return ret; /* shift > 0 */ } -#undef silk_ADD_RSHIFT_uint + +#undef silk_ADD_RSHIFT_uint static inline opus_uint32 silk_ADD_RSHIFT_uint(opus_uint32 a, opus_uint32 b, opus_int32 shift){ opus_uint32 ret; silk_assert(shift >= 0); @@ -460,7 +475,8 @@ static inline opus_uint32 silk_ADD_RSHIFT_uint(opus_uint32 a, opus_uint32 b, opu silk_assert((opus_int64)ret == (opus_int64)a + (((opus_int64)b) >> shift)); return ret; /* shift > 0 */ } -#undef silk_SUB_LSHIFT32 + +#undef silk_SUB_LSHIFT32 static inline opus_int32 silk_SUB_LSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ opus_int32 ret; silk_assert(shift >= 0); @@ -469,7 +485,8 @@ static inline opus_int32 silk_SUB_LSHIFT32(opus_int32 a, opus_int32 b, opus_int3 silk_assert((opus_int64)ret == (opus_int64)a - (((opus_int64)b) << shift)); return ret; /* shift >= 0 */ } -#undef silk_SUB_RSHIFT32 + +#undef silk_SUB_RSHIFT32 static inline opus_int32 silk_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int32 shift){ opus_int32 ret; silk_assert(shift >= 0); @@ -479,7 +496,7 @@ static inline opus_int32 silk_SUB_RSHIFT32(opus_int32 a, opus_int32 b, opus_int3 return ret; /* shift > 0 */ } -#undef silk_RSHIFT_ROUND +#undef silk_RSHIFT_ROUND static inline opus_int32 silk_RSHIFT_ROUND(opus_int32 a, opus_int32 shift){ opus_int32 ret; silk_assert(shift > 0); /* the marco definition can't handle a shift of zero */ @@ -489,7 +506,7 @@ static inline opus_int32 silk_RSHIFT_ROUND(opus_int32 a, opus_int32 shift){ return ret; } -#undef silk_RSHIFT_ROUND64 +#undef silk_RSHIFT_ROUND64 static inline opus_int64 silk_RSHIFT_ROUND64(opus_int64 a, opus_int32 shift){ opus_int64 ret; silk_assert(shift > 0); /* the marco definition can't handle a shift of zero */ @@ -499,25 +516,25 @@ static inline opus_int64 silk_RSHIFT_ROUND64(opus_int64 a, opus_int32 shift){ } /* silk_abs is used on floats also, so doesn't work... */ -/*#undef silk_abs +/*#undef silk_abs static inline opus_int32 silk_abs(opus_int32 a){ silk_assert(a != 0x80000000); return (((a) > 0) ? (a) : -(a)); // Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN }*/ -#undef silk_abs_int64 +#undef silk_abs_int64 static inline opus_int64 silk_abs_int64(opus_int64 a){ silk_assert(a != 0x8000000000000000); return (((a) > 0) ? (a) : -(a)); /* Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN */ } -#undef silk_abs_int32 +#undef silk_abs_int32 static inline opus_int32 silk_abs_int32(opus_int32 a){ silk_assert(a != 0x80000000); return abs(a); } -#undef silk_CHECK_FIT8 +#undef silk_CHECK_FIT8 static inline opus_int8 silk_CHECK_FIT8( opus_int64 a ){ opus_int8 ret; ret = (opus_int8)a; @@ -525,7 +542,7 @@ static inline opus_int8 silk_CHECK_FIT8( opus_int64 a ){ return( ret ); } -#undef silk_CHECK_FIT16 +#undef silk_CHECK_FIT16 static inline opus_int16 silk_CHECK_FIT16( opus_int64 a ){ opus_int16 ret; ret = (opus_int16)a; @@ -533,7 +550,7 @@ static inline opus_int16 silk_CHECK_FIT16( opus_int64 a ){ return( ret ); } -#undef silk_CHECK_FIT32 +#undef silk_CHECK_FIT32 static inline opus_int32 silk_CHECK_FIT32( opus_int64 a ){ opus_int32 ret; ret = (opus_int32)a; |