extmod/utime_mphal: Fix comment re delta range check in time_ticks_add.
Signed-off-by: Damien George <damien@micropython.org>
This commit is contained in:
parent
e1f211c6b5
commit
fe330c74f4
@ -103,7 +103,7 @@ STATIC mp_obj_t time_ticks_add(mp_obj_t ticks_in, mp_obj_t delta_in) {
|
|||||||
// The latter requires excluding delta=-TICKS_PERIOD/2.
|
// The latter requires excluding delta=-TICKS_PERIOD/2.
|
||||||
//
|
//
|
||||||
// This unsigned comparison is equivalent to a signed comparison of:
|
// This unsigned comparison is equivalent to a signed comparison of:
|
||||||
// delta <= TICKS_PERIOD/2 || delta >= TICKS_PERIOD/2
|
// delta <= -TICKS_PERIOD/2 || delta >= TICKS_PERIOD/2
|
||||||
if (delta + MICROPY_PY_UTIME_TICKS_PERIOD / 2 - 1 >= MICROPY_PY_UTIME_TICKS_PERIOD - 1) {
|
if (delta + MICROPY_PY_UTIME_TICKS_PERIOD / 2 - 1 >= MICROPY_PY_UTIME_TICKS_PERIOD - 1) {
|
||||||
mp_raise_msg(&mp_type_OverflowError, MP_ERROR_TEXT("ticks interval overflow"));
|
mp_raise_msg(&mp_type_OverflowError, MP_ERROR_TEXT("ticks interval overflow"));
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user