Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJean-Marc Valin <jmvalin@jmvalin.ca>2011-10-12 00:47:00 +0400
committerJean-Marc Valin <jmvalin@jmvalin.ca>2011-10-12 00:47:00 +0400
commit4541bbcc22c6289f3a2a70fda88a9aa372535b58 (patch)
treedb4b21988e8db63302f6d74e44902ed2668fa294 /silk/SigProc_FIX.h
parent37378626205c46690629dd6291ec528703b4ae60 (diff)
Gets rid of a "safe" signed overflow in silk_DIV32_varQ()
Diffstat (limited to 'silk/SigProc_FIX.h')
-rw-r--r--silk/SigProc_FIX.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/silk/SigProc_FIX.h b/silk/SigProc_FIX.h
index a65ac13f..f9e2664a 100644
--- a/silk/SigProc_FIX.h
+++ b/silk/SigProc_FIX.h
@@ -417,6 +417,9 @@ static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
/* Adds two signed 32-bit values in a way that can overflow, while not relying on undefined behaviour
(just standard two's complement implementation-specific behaviour) */
#define silk_ADD32_ovflw(a, b) ((opus_int32)((opus_uint32)(a) + (opus_uint32)(b)))
+/* Subtractss two signed 32-bit values in a way that can overflow, while not relying on undefined behaviour
+ (just standard two's complement implementation-specific behaviour) */
+#define silk_SUB32_ovflw(a, b) ((opus_int32)((opus_uint32)(a) - (opus_uint32)(b)))
/* Multiply-accumulate macros that allow overflow in the addition (ie, no asserts in debug mode)*/
#define silk_MLA_ovflw(a32, b32, c32) silk_ADD32_ovflw((a32), (opus_uint32)(b32) * (opus_uint32)(c32))
@@ -484,6 +487,7 @@ static inline opus_int32 silk_ROR32( opus_int32 a32, opus_int rot )
#define silk_LSHIFT_SAT32(a, shift) (silk_LSHIFT32( silk_LIMIT( (a), silk_RSHIFT32( silk_int32_MIN, (shift) ), \
silk_RSHIFT32( silk_int32_MAX, (shift) ) ), (shift) ))
+#define silk_LSHIFT_ovflw(a, shift) ((opus_int32)((opus_uint32)(a)<<(shift))) /* shift >= 0, allowed to overflow */
#define silk_LSHIFT_uint(a, shift) ((a)<<(shift)) /* shift >= 0 */
#define silk_RSHIFT_uint(a, shift) ((a)>>(shift)) /* shift >= 0 */