From nobody Thu Nov 13 23:37:44 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org ARC-Seal: i=1; a=rsa-sha256; t=1583176378; cv=none; d=zohomail.com; s=zohoarc; b=IZEWwrjQCYhIC//vXfr3YE/L5hw0tc/KOcTwRO+JdVcK3FPNdY06f/C7phgvXjf3aBnG0IcGs6cTNDkoA2bHdOzScn6+OKpS9I5lZl7w8BcwK9e2UZHp5x4MsA5p+LpekOjEm+IA2IgnbUOXZ4yciitShtXiMaC0wx2AqdChR6A= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1583176378; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=2P7DtZP9Ew8I3tQ9CE1ef2w0h0dKJQ1zJOs1xQCaz7U=; b=bU0fFiAi36rDLbFK99xKBMI2xp702xxwAQwDCYTdVbh9Hz9vIFWgJyHnqot/JZpNBdGaxtmc8wL7MlsVVXJrUQZw/iJTjQyR4oggSM3tMMZyfyCNu0N+TNVC5mbQ3qxhw6TZ+I3+yDkvd6iBfr3OYXZ8d+0ec99j+w59fp1baQc= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1583176378143172.3143072413244; Mon, 2 Mar 2020 11:12:58 -0800 (PST) Received: from localhost ([::1]:37530 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j8qUr-0007TB-07 for importer@patchew.org; Mon, 02 Mar 2020 14:12:57 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:53347) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1j8qSH-0003uY-Qh for qemu-devel@nongnu.org; Mon, 02 Mar 2020 14:10:18 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1j8qSG-0005Fm-Rl for qemu-devel@nongnu.org; Mon, 02 Mar 2020 14:10:17 -0500 Received: from mailout01.t-online.de ([194.25.134.80]:48544) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1j8qSG-0005Er-LG for qemu-devel@nongnu.org; Mon, 02 Mar 2020 14:10:16 -0500 Received: from fwd02.aul.t-online.de (fwd02.aul.t-online.de [172.20.26.148]) by mailout01.t-online.de (Postfix) with SMTP id C08C3421E456; Mon, 2 Mar 2020 20:10:15 +0100 (CET) Received: from linpower.localnet (r44a3+ZUYh1HEwfogxLXoOS8jYkKsHoyDYbDBU25v+w2CCzIul-DdxdwLPlrojDght@[79.208.28.226]) by fwd02.t-online.de with (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384 encrypted) esmtp id 1j8qSF-03bHiC0; Mon, 2 Mar 2020 20:10:15 +0100 Received: by linpower.localnet (Postfix, from userid 1000) id 9473621B1C2; Mon, 2 Mar 2020 20:10:04 +0100 (CET) From: =?UTF-8?q?Volker=20R=C3=BCmelin?= To: Gerd Hoffmann , Eric Blake , Markus Armbruster Subject: [PATCH 5/5] audio: fix saturation nonlinearity in clip_* functions Date: Mon, 2 Mar 2020 20:10:04 +0100 Message-Id: <20200302191004.5991-5-vr_qemu@t-online.de> X-Mailer: git-send-email 2.16.4 In-Reply-To: <417bfe2f-e3c1-d83d-b437-47859daf524d@t-online.de> References: <417bfe2f-e3c1-d83d-b437-47859daf524d@t-online.de> MIME-Version: 1.0 X-ID: r44a3+ZUYh1HEwfogxLXoOS8jYkKsHoyDYbDBU25v+w2CCzIul-DdxdwLPlrojDght X-TOI-MSGID: 2c7527be-66b1-4209-a59d-a0184378cd26 Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-Received-From: 194.25.134.80 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: John Arbuckle , Howard Spoelstra , Mark Cave-Ayland , QEMU , =?UTF-8?q?Zolt=C3=A1n=20K=C5=91v=C3=A1g=C3=B3?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" Content-Type: text/plain; charset="utf-8" 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=C3=BCmelin --- audio/mixeng_template.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/audio/mixeng_template.h b/audio/mixeng_template.h index fc8e1d4d9e..bc8509e423 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) =20 static inline IN_T glue (clip_, ET) (int64_t v) { - if (v >=3D 0x7f000000) { + if (v >=3D 0x7fffffffLL) { return IN_MAX; - } - else if (v < -2147483648LL) { + } else if (v < -2147483648LL) { return IN_MIN; } =20 --=20 2.16.4