libopencm3
libopencm3 copied to clipboard
usb: avoid modulo operation
The current code uses modulo using a divisor which is not necessarily a power of two. This pulls in __aeabi_idivmod and other libgcc provided functions dealing with division.
The code can be rewritten to determine if a zero-length packet is actually required once we are transfering the last packet. This improves runtime as well as code size.
Successfully tested against the gadget-zero test case:
# python test_gadget0.py
Running (user) tests for DUT: stm32f072disco
............ss.................
----------------------------------------------------------------------
Ran 31 tests in 0.333s
OK (skipped=2)
This looks good, thanks :)
Is there anything on my side to get this merged?
no, this is blocked at my end.