From d1cf9c4bfd946a2abf2fd59ae954582d7c3158e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Roussel?= Date: Wed, 27 Aug 2014 12:34:26 +0200 Subject: [PATCH] Ensure hwtimer_spin() won't wait for an unreachable stop counter value without using a costly MOD operation --- core/hwtimer.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/hwtimer.c b/core/hwtimer.c index 4814145296..46f36bbf8c 100644 --- a/core/hwtimer.c +++ b/core/hwtimer.c @@ -68,7 +68,7 @@ void hwtimer_spin(unsigned long ticks) unsigned long start = hwtimer_arch_now(); /* compute destination time, possibly resulting in an overflow */ - unsigned long stop = start + ticks; + unsigned long stop = ((start + ticks) & HWTIMER_MAXTICKS); /* * If there is an overflow (that is: stop time is inferior to start),