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

Function fletcher64

libraries/Fletcher/Fletcher.cpp:59–75  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

57
58
59uint64_t fletcher64(uint32_t *data, uint16_t length, uint64_t s1, uint64_t s2)
60{
61 uint64_t _s1 = s1;
62 uint64_t _s2 = s2;
63 for (uint16_t i = 0; i < length;)
64 {
65 // if _s2 is halfway it is time to do modulo
66 while ((i < length) && (_s2 < 9223372036854775808ULL)) // MAGIC NR
67 {
68 _s1 += data[i++];
69 _s2 += _s1;
70 }
71 _s1 %= FLETCHER_64;
72 _s2 %= FLETCHER_64;
73 }
74 return (_s2 << 32) | _s1;
75}
76
77
78// -- END OF FILE --

Callers 1

unittestFunction · 0.85

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.68