Received: from eggs.gnu.org ([2001:4830:134:3::10]:55857) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1azlBZ-00011G-As for qemu-devel@nongnu.org; Mon, 09 May 2016 09:25:27 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1azlBU-00041k-BL for qemu-devel@nongnu.org; Mon, 09 May 2016 09:25:20 -0400 From: 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> Subject: [Qemu-devel] [PATCH v2 4/5] replace muldiv64(a, b, c) by (uint64_t)a * b / c List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, qemu-trivial@nongnu.org Cc: Richard Henderson , Laurent Vivier 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