From fa03cb14d8e0f3ce946f7b7ed17fd1726dddaf9b Mon Sep 17 00:00:00 2001 From: Frederic Petrot Date: Tue, 4 Nov 2025 22:29:10 +0100 Subject: [PATCH] Changement de la multiplication dans invaders MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Afin d'éviter les problèmes d'édition de liens avec l'option -Os sous gcc-15 --- bench/invaders.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bench/invaders.c b/bench/invaders.c index 3e59fb5..030f340 100644 --- a/bench/invaders.c +++ b/bench/invaders.c @@ -132,11 +132,11 @@ static volatile uint32_t *timer_lo = (volatile uint32_t *)CLINT_TIMER_LOW; static volatile uint32_t *timer_cmp_hi = (volatile uint32_t *)CLINT_TIMER_CMP_HI; static volatile uint32_t *timer_cmp_lo = (volatile uint32_t *)CLINT_TIMER_CMP_LO; -uint32_t mult(uint64_t x, uint64_t y) +uint64_t mult(uint32_t x, uint32_t y) { uint64_t res = 0; while (y != 0) { - if (y % 2 == 1) { + if (y & 1) { res += x; } x <<= 1; @@ -148,7 +148,7 @@ uint32_t mult(uint64_t x, uint64_t y) void timer_set(uint32_t period, uint32_t time) { uint64_t now = *timer; - *timer_cmp = now + mult(((uint64_t)period >> 8), time); + *timer_cmp = now + mult(period >> 8, time); } void timer_wait(void)