Skip to content
Snippets Groups Projects
Commit d1cf9c4b authored by Kévin Roussel's avatar Kévin Roussel
Browse files

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

without using a costly MOD operation
parent 752fe547
No related branches found
No related tags found
No related merge requests found
...@@ -68,7 +68,7 @@ void hwtimer_spin(unsigned long ticks) ...@@ -68,7 +68,7 @@ void hwtimer_spin(unsigned long ticks)
unsigned long start = hwtimer_arch_now(); unsigned long start = hwtimer_arch_now();
/* compute destination time, possibly resulting in an overflow */ /* 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), * If there is an overflow (that is: stop time is inferior to start),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment