1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

Ensure hwtimer_spin() won't wait for an unreachable stop counter value

without using a costly MOD operation
This commit is contained in:
Kévin Roussel 2014-08-27 12:34:26 +02:00
parent 752fe547ca
commit d1cf9c4bfd

View File

@ -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),