ViperTypeError: div/mod not implemented for uint
General topic, not related to a specific micro.
Viper is great for optimizing functions, like custom hashes, that only do calculations on integers... but
ViperTypeError: div/mod not implemented for uint
Is it possible to implement this?
docs: micropython.viper: number of arguments in functions
From the official doc https://docs.micropython.org/en/v1.9.3/pyboard/reference/speed_python.html#the-viper-code-emitter
In addition to the restrictions imposed by the native emitter the following constraints apply:
- Functions may have up to four arguments
Well, I am using a function with 7 arguments... and it works.
I tested the crc calculation with 19 different polynomials, input data "123456789" and the expected results published here
https://crccalc.com/
@micropython.viper
def crc_msb(shift: uint, data: ptr8, ldata: int, init: uint, poly: uint, xor_in: uint = 0, xor_out: uint = 0) -> uint :
...
Mmh to be sure, how do you suggest to check if the function is running optimized or not?
(preferably a method not depending on execution times).
Is it the documentation up-to-date?