diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2016-04-19 16:21:08 -0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2016-06-02 15:13:35 -0400 |
commit | 2ce3eae225e0422853cfda561074edc9c84fab96 (patch) | |
tree | c6c4fe38242579eb54fe5bb80b4c09211b83371c | |
parent | d2141327c77bef48e93a863be71e4959229f68bd (diff) | |
download | opus-2ce3eae225e0422853cfda561074edc9c84fab96.tar.gz |
Fixes signed integer overlof in silk_ADD_POS_SAT32()
Removes unused 64-bit version
-rw-r--r-- | silk/MacroCount.h | 8 | ||||
-rw-r--r-- | silk/MacroDebug.h | 3 | ||||
-rw-r--r-- | silk/SigProc_FIX.h | 3 |
3 files changed, 2 insertions, 12 deletions
diff --git a/silk/MacroCount.h b/silk/MacroCount.h index 834817d0..54dbdbd9 100644 --- a/silk/MacroCount.h +++ b/silk/MacroCount.h @@ -319,14 +319,6 @@ static OPUS_INLINE opus_int32 silk_ADD_POS_SAT32(opus_int64 a, opus_int64 b){ return(tmp); } -#undef silk_ADD_POS_SAT64 -static OPUS_INLINE opus_int64 silk_ADD_POS_SAT64(opus_int64 a, opus_int64 b){ - opus_int64 tmp; - ops_count += 1; - tmp = ((((a)+(b)) & 0x8000000000000000LL) ? silk_int64_MAX : ((a)+(b))); - return(tmp); -} - #undef silk_LSHIFT8 static OPUS_INLINE opus_int8 silk_LSHIFT8(opus_int8 a, opus_int32 shift){ opus_int8 ret; diff --git a/silk/MacroDebug.h b/silk/MacroDebug.h index 35aedc5c..8dd4ce2e 100644 --- a/silk/MacroDebug.h +++ b/silk/MacroDebug.h @@ -539,8 +539,7 @@ static OPUS_INLINE opus_int32 silk_DIV32_16_(opus_int32 a32, opus_int32 b32, cha no checking needed for silk_POS_SAT32 no checking needed for silk_ADD_POS_SAT8 no checking needed for silk_ADD_POS_SAT16 - no checking needed for silk_ADD_POS_SAT32 - no checking needed for silk_ADD_POS_SAT64 */ + no checking needed for silk_ADD_POS_SAT32 */ #undef silk_LSHIFT8 #define silk_LSHIFT8(a,b) silk_LSHIFT8_((a), (b), __FILE__, __LINE__) diff --git a/silk/SigProc_FIX.h b/silk/SigProc_FIX.h index b6329944..3d3161c9 100644 --- a/silk/SigProc_FIX.h +++ b/silk/SigProc_FIX.h @@ -471,8 +471,7 @@ static OPUS_INLINE opus_int32 silk_ROR32( opus_int32 a32, opus_int rot ) /* Add with saturation for positive input values */ #define silk_ADD_POS_SAT8(a, b) ((((a)+(b)) & 0x80) ? silk_int8_MAX : ((a)+(b))) #define silk_ADD_POS_SAT16(a, b) ((((a)+(b)) & 0x8000) ? silk_int16_MAX : ((a)+(b))) -#define silk_ADD_POS_SAT32(a, b) ((((a)+(b)) & 0x80000000) ? silk_int32_MAX : ((a)+(b))) -#define silk_ADD_POS_SAT64(a, b) ((((a)+(b)) & 0x8000000000000000LL) ? silk_int64_MAX : ((a)+(b))) +#define silk_ADD_POS_SAT32(a, b) ((((opus_uint32)(a)+(opus_uint32)(b)) & 0x80000000) ? silk_int32_MAX : ((a)+(b))) #define silk_LSHIFT8(a, shift) ((opus_int8)((opus_uint8)(a)<<(shift))) /* shift >= 0, shift < 8 */ #define silk_LSHIFT16(a, shift) ((opus_int16)((opus_uint16)(a)<<(shift))) /* shift >= 0, shift < 16 */ |