Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/RobTillaart/Arduino
/ bitCountKR
Function
bitCountKR
libraries/bitHelpers/bitHelpers.cpp:32–43 ·
view source on GitHub ↗
Source
from the content-addressed store, hash-verified
30
31
32
uint8_t bitCountKR(uint32_t value)
33
{
34
// Kerningham & Ritchie
35
uint32_t v = value;
36
uint8_t count = 0;
37
while (v)
38
{
39
count++;
40
v &= (v - 1);
41
}
42
return count;
43
}
44
45
46
uint8_t bitCountArray(uint32_t value)
Callers
1
unittest
Function · 0.85
Calls
no outgoing calls
Tested by
1
unittest
Function · 0.68