1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00
RIOT/sys/ztimer
Kaspar Schleiser 1ff609167e ztimer: convert_frac: use self->scale_now for max_value
When using convert_frac to slow down a timer, the extension machinery is
used to prevent converting values that would be larger than, after
conversion, 2**32. In order to calculate the maximum value, UINT32_MAX
is converted.

Previously, this was mistakenly converted by multiplying with the
fraction used to scale up a value. E.g., when using convert_frac to
slow down a 1us timer to provide a 1ms timer, UINT32_MAX was multiplied
by 1000. As the result is used % UINT32_MAX, this lead to a wrong value
close to UINT32_MAX, as ((UINT32_MAX * N) % UINT32_MAX = (UINT32_MAX - N - 1)).

This PR fixes the calculation so max_value is determined by multiplying
with the fraction used to scale down a value.
2020-06-16 12:24:11 +02:00
..
auto_init.c sys/ztimer: uncrustify 2020-05-11 16:43:50 +02:00
convert_frac.c ztimer: convert_frac: use self->scale_now for max_value 2020-06-16 12:24:11 +02:00
convert_muldiv64.c sys/ztimer: uncrustify 2020-05-11 16:43:50 +02:00
convert_shift.c sys: add ztimer subsystem 2020-03-04 12:44:02 +01:00
convert.c sys/ztimer: uncrustify 2020-05-11 16:43:50 +02:00
core.c sys/ztimer: uncrustify 2020-05-11 16:43:50 +02:00
Makefile Makefile: remove usage of SUBMODULES_NOFORCE 2020-04-15 12:11:44 +02:00
Makefile.dep ztimer: pull in xtimer_on_ztimer only if ztimer_usec is used 2020-05-06 20:18:13 +02:00
mock.c sys/ztimer: uncrustify 2020-05-11 16:43:50 +02:00
overhead.c sys/ztimer: make ztimer_overhead() return signed value (int32_t) 2020-03-10 12:23:33 +01:00
periph_rtc.c sys: add ztimer subsystem 2020-03-04 12:44:02 +01:00
periph_rtt.c sys/ztimer: properly initialize intermediate extension callback 2020-05-04 17:25:27 +02:00
periph_timer.c sys/ztimer: uncrustify 2020-05-11 16:43:50 +02:00
util.c sys/ztimer: uncrustify 2020-05-11 16:43:50 +02:00
xtimer2ztimer.cocci sys/ztimer: add coccinelle script for xtimer -> ztimer conversion 2020-03-04 12:44:02 +01:00