From fe330c74f430a006cb54fff250ed22d7038fb6d0 Mon Sep 17 00:00:00 2001 From: Damien George Date: Wed, 15 Feb 2023 14:16:31 +1100 Subject: [PATCH] extmod/utime_mphal: Fix comment re delta range check in time_ticks_add. Signed-off-by: Damien George --- extmod/utime_mphal.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/extmod/utime_mphal.c b/extmod/utime_mphal.c index cd91c95530..9cd5d938d0 100644 --- a/extmod/utime_mphal.c +++ b/extmod/utime_mphal.c @@ -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")); }