From: Volker RĂ¼melin Date: Sun, 8 Mar 2020 19:33:20 +0000 (+0100) Subject: audio: fix saturation nonlinearity in clip_* functions X-Git-Tag: v5.0.0-rc0~35^2~1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=194bdf50697689768335096b6c01c5b010f023ca;p=thirdparty%2Fqemu.git audio: fix saturation nonlinearity in clip_* functions The current positive limit for the saturation nonlinearity is only correct if the type of the result has 8 bits or less. Signed-off-by: Volker RĂ¼melin Message-id: 20200308193321.20668-5-vr_qemu@t-online.de Signed-off-by: Gerd Hoffmann --- diff --git a/audio/mixeng_template.h b/audio/mixeng_template.h index fc8e1d4d9eb..bc8509e423f 100644 --- a/audio/mixeng_template.h +++ b/audio/mixeng_template.h @@ -83,10 +83,9 @@ static inline int64_t glue (conv_, ET) (IN_T v) static inline IN_T glue (clip_, ET) (int64_t v) { - if (v >= 0x7f000000) { + if (v >= 0x7fffffffLL) { return IN_MAX; - } - else if (v < -2147483648LL) { + } else if (v < -2147483648LL) { return IN_MIN; }