kernel/timer: Slightly optimize spin().
Move the math operation out of the loop.
This commit is contained in:
@@ -446,8 +446,8 @@ cancel_timer(timer* event)
|
|||||||
void
|
void
|
||||||
spin(bigtime_t microseconds)
|
spin(bigtime_t microseconds)
|
||||||
{
|
{
|
||||||
bigtime_t time = system_time();
|
bigtime_t target = system_time() + microseconds;
|
||||||
|
|
||||||
while ((system_time() - time) < microseconds)
|
while (system_time() < target)
|
||||||
cpu_pause();
|
cpu_pause();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user