[opus] [Aarch64 v2 13/18] Explicitly cast results of silk OPUS_FAST_INT64 macros back to opus_int32.

Jonathan Lennox jonathan at vidyo.com
Fri Nov 20 20:03:54 PST 2015


---
 silk/macros.h | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/silk/macros.h b/silk/macros.h
index 1ba614a..e1e05b9 100644
--- a/silk/macros.h
+++ b/silk/macros.h
@@ -48,14 +48,14 @@ POSSIBILITY OF SUCH DAMAGE.
 
 /* (a32 * (opus_int32)((opus_int16)(b32))) >> 16 output have to be 32bit int */
 #if OPUS_FAST_INT64
-#define silk_SMULWB(a32, b32)            (((a32) * (opus_int64)((opus_int16)(b32))) >> 16)
+#define silk_SMULWB(a32, b32)            ((opus_int32)(((a32) * (opus_int64)((opus_int16)(b32))) >> 16))
 #else
 #define silk_SMULWB(a32, b32)            ((((a32) >> 16) * (opus_int32)((opus_int16)(b32))) + ((((a32) & 0x0000FFFF) * (opus_int32)((opus_int16)(b32))) >> 16))
 #endif
 
 /* a32 + (b32 * (opus_int32)((opus_int16)(c32))) >> 16 output have to be 32bit int */
 #if OPUS_FAST_INT64
-#define silk_SMLAWB(a32, b32, c32)       ((a32) + (((b32) * (opus_int64)((opus_int16)(c32))) >> 16))
+#define silk_SMLAWB(a32, b32, c32)       ((opus_int32)((a32) + (((b32) * (opus_int64)((opus_int16)(c32))) >> 16)))
 #else
 #define silk_SMLAWB(a32, b32, c32)       ((a32) + ((((b32) >> 16) * (opus_int32)((opus_int16)(c32))) + ((((b32) & 0x0000FFFF) * (opus_int32)((opus_int16)(c32))) >> 16)))
 #endif
@@ -65,7 +65,7 @@ POSSIBILITY OF SUCH DAMAGE.
 
 /* a32 + (b32 * (c32 >> 16)) >> 16 */
 #if OPUS_FAST_INT64
-#define silk_SMLAWT(a32, b32, c32)       ((a32) + (((b32) * ((opus_int64)(c32) >> 16)) >> 16))
+#define silk_SMLAWT(a32, b32, c32)       ((opus_int32)((a32) + (((b32) * ((opus_int64)(c32) >> 16)) >> 16)))
 #else
 #define silk_SMLAWT(a32, b32, c32)       ((a32) + (((b32) >> 16) * ((c32) >> 16)) + ((((b32) & 0x0000FFFF) * ((c32) >> 16)) >> 16))
 #endif
@@ -87,14 +87,14 @@ POSSIBILITY OF SUCH DAMAGE.
 
 /* (a32 * b32) >> 16 */
 #if OPUS_FAST_INT64
-#define silk_SMULWW(a32, b32)            (((opus_int64)(a32) * (b32)) >> 16)
+#define silk_SMULWW(a32, b32)            ((opus_int32)(((opus_int64)(a32) * (b32)) >> 16))
 #else
 #define silk_SMULWW(a32, b32)            silk_MLA(silk_SMULWB((a32), (b32)), (a32), silk_RSHIFT_ROUND((b32), 16))
 #endif
 
 /* a32 + ((b32 * c32) >> 16) */
 #if OPUS_FAST_INT64
-#define silk_SMLAWW(a32, b32, c32)       ((a32) + (((opus_int64)(b32) * (c32)) >> 16))
+#define silk_SMLAWW(a32, b32, c32)       ((opus_int32)((a32) + (((opus_int64)(b32) * (c32)) >> 16)))
 #else
 #define silk_SMLAWW(a32, b32, c32)       silk_MLA(silk_SMLAWB((a32), (b32), (c32)), (b32), silk_RSHIFT_ROUND((c32), 16))
 #endif
-- 
2.4.9 (Apple Git-60)



More information about the opus mailing list