shithub: opus

Download patch

ref: 2fa9e6e5386fa5ef0bbe41038ca30bc16810ebb3
parent: 9620cf7718d5f3e580b6457cf131ddf424312115
author: Ralph Giles <[email protected]>
date: Wed Nov 30 05:48:32 EST 2011

Fix a signed-compare warning.

The silk math debug macros include a bounds check on silk_abs.
Because INT_MIN = (-INT_MAX - 1), abs(INT_MIN) can't be
represented as an int. The macro was checking for this value
as 0x8000... without a cast to signed, warning on gcc.

silk/typedef.h already defines minimum values for the int
types, so we correct the warning by using those.

--- a/silk/MacroDebug.h
+++ b/silk/MacroDebug.h
@@ -524,13 +524,13 @@
 
 #undef silk_abs_int64
 static inline opus_int64 silk_abs_int64(opus_int64 a){
-    silk_assert(a != 0x8000000000000000);
+    silk_assert(a != silk_int64_MIN);
     return (((a) >  0)  ? (a) : -(a));            /* Be careful, silk_abs returns wrong when input equals to silk_intXX_MIN */
 }
 
 #undef silk_abs_int32
 static inline opus_int32 silk_abs_int32(opus_int32 a){
-    silk_assert(a != 0x80000000);
+    silk_assert(a != silk_int32_MIN);
     return abs(a);
 }