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

Method count

libraries/Set/Set.cpp:75–91  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73
74
75uint16_t Set::count() const
76{
77 uint16_t cnt = 0;
78
79 uint8_t i = 32;
80 do
81 {
82 // Kerningham bit count trick
83 uint8_t b = _mem[--i];
84 for (; b; cnt++)
85 {
86 b &= b-1;
87 }
88 }
89 while (i != 0);
90 return cnt;
91}
92
93
94void Set::clear()

Callers 1

unittestFunction · 0.45

Calls

no outgoing calls

Tested by 1

unittestFunction · 0.36