extmod/utime_mphal: Fix comment re delta range check in time_ticks_add.

Signed-off-by: Damien George <damien@micropython.org>
pull/8236/merge
Damien George 2023-02-15 14:16:31 +11:00
rodzic e1f211c6b5
commit fe330c74f4
1 zmienionych plików z 1 dodań i 1 usunięć

Wyświetl plik

@ -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.
//
// 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) {
mp_raise_msg(&mp_type_OverflowError, MP_ERROR_TEXT("ticks interval overflow"));
}