MCPcopy Create free account
hub / github.com/RobTillaart/Arduino / divmod3

Function divmod3

libraries/fast_math/fast_math.cpp:33–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

31
32
33void divmod3(uint32_t in, uint32_t *div, uint8_t *mod)
34{
35 uint32_t q = (in >> 1) + (in >> 3);
36 q = q + (q >> 4);
37 q = q + (q >> 8);
38 q = q + (q >> 16);
39 q = q >> 1;
40 uint32_t r = in - q * 3;
41 q = q + (r * 86 >> 8);
42 *div = q;
43 *mod = in - q * 3;
44}
45
46
47void divmod5(uint32_t in, uint32_t *div, uint8_t *mod)

Callers 2

divmod12Function · 0.85
divmod24Function · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected