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

Function bitCountArray

libraries/bitHelpers/bitHelpers.cpp:46–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44
45
46uint8_t bitCountArray(uint32_t value)
47{
48 uint8_t ar[] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4};
49 uint32_t v = value;
50 uint8_t count = 0;
51 while (v)
52 {
53 count += ar[v & 0x0F];
54 v >>= 4;
55 }
56 return count;
57}
58
59
60uint8_t bitCountF1(uint32_t value)

Callers 1

unittestFunction · 0.85

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.68