Skip to content
Snippets Groups Projects
Commit 2fa9e6e5 authored by Ralph Giles's avatar Ralph Giles
Browse files

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.
parent 9620cf77
No related branches found
No related tags found
No related merge requests found
......@@ -524,13 +524,13 @@ static inline opus_int32 silk_abs(opus_int32 a){
#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);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment