Skip to content

Commit

Permalink
xtimer_now: remove redundant substraction operation
Browse files Browse the repository at this point in the history
  • Loading branch information
Hyungsin committed Jan 5, 2018
1 parent a6c2c52 commit 0fff745
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions sys/include/xtimer/implementation.h
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,8 @@ static inline uint32_t _xtimer_now(void)
uint32_t now_s;

do {
now_s = _stimer_lltimer_now();
if (now_s >= prev_s) {
diff_s = now_s - prev_s;
} else {
diff_s = (0xFFFFFFFF-prev_s) + now_s;
}
now_s = _stimer_lltimer_now();
diff_s = now_s - prev_s;
} while (diff_s < STIMER_HZ/XTIMER_HZ);

return _xtimer_lltimer_mask(prev_x + (uint32_t)(diff_s*XTIMER_HZ/STIMER_HZ));
Expand Down

0 comments on commit 0fff745

Please sign in to comment.