From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from list by lists.gnu.org with archive (Exim 4.71) id 1azlBt-0001lX-5P for mharc-qemu-trivial@gnu.org; Mon, 09 May 2016 09:25:41 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55933) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azlBm-0001VN-NA for qemu-trivial@nongnu.org; Mon, 09 May 2016 09:25:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azlBf-000448-Mt for qemu-trivial@nongnu.org; Mon, 09 May 2016 09:25:33 -0400 Received: from mx1.redhat.com ([209.132.183.28]:44835) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azlBU-00041d-6F; Mon, 09 May 2016 09:25:16 -0400 Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C947D7F6A4; Mon, 9 May 2016 13:25:15 +0000 (UTC) Received: from thinkpad.redhat.com (ovpn-112-28.ams2.redhat.com [10.36.112.28]) by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id u49DP4ch017024; Mon, 9 May 2016 09:25:14 -0400 From: Laurent Vivier To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org Cc: Richard Henderson , Laurent Vivier Date: Mon, 9 May 2016 15:24:58 +0200 Message-Id: <1462800299-12641-5-git-send-email-lvivier@redhat.com> In-Reply-To: <1462800299-12641-1-git-send-email-lvivier@redhat.com> References: <1462800299-12641-1-git-send-email-lvivier@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Mon, 09 May 2016 13:25:15 +0000 (UTC) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 209.132.183.28 Subject: [Qemu-trivial] [PATCH v2 4/5] replace muldiv64(a, b, c) by (uint64_t)a * b / c X-BeenThere: qemu-trivial@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 May 2016 13:25:39 -0000 When "a" and "b" are 32bit values, we don't have to cast them to 128bit, 64bit is enough. This patch is the result of coccinelle script scripts/coccinelle/simplify_muldiv64.cocci Signed-off-by: Laurent Vivier --- hw/audio/gus.c | 2 +- hw/xtensa/pic_cpu.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/hw/audio/gus.c b/hw/audio/gus.c index 9dd6947..6c02646 100644 --- a/hw/audio/gus.c +++ b/hw/audio/gus.c @@ -144,7 +144,7 @@ static void GUS_callback (void *opaque, int free) s->left = samples; reset: - gus_irqgen (&s->emu, muldiv64 (net, 1000000, s->freq)); + gus_irqgen (&s->emu, (uint64_t)net * 1000000 / s->freq); } int GUS_irqrequest (GUSEmuState *emu, int hwirq, int n) diff --git a/hw/xtensa/pic_cpu.c b/hw/xtensa/pic_cpu.c index c835bd0..343ea2c 100644 --- a/hw/xtensa/pic_cpu.c +++ b/hw/xtensa/pic_cpu.c @@ -121,8 +121,8 @@ void xtensa_rearm_ccompare_timer(CPUXtensaState *env) } env->wake_ccount = wake_ccount; timer_mod(env->ccompare_timer, env->halt_clock + - muldiv64(wake_ccount - env->sregs[CCOUNT], - 1000000, env->config->clock_freq_khz)); + (uint64_t)(wake_ccount - env->sregs[CCOUNT]) * + 1000000 / env->config->clock_freq_khz); } static void xtensa_ccompare_cb(void *opaque) -- 2.5.5