MCPcopy Create free account
hub / github.com/creatale/node-dv / NumSetBits

Method NumSetBits

deps/tesseract/ccutil/bitvector.cpp:212–223  ·  view source on GitHub ↗

Returns the number of set bits in the vector.

Source from the content-addressed store, hash-verified

210
211// Returns the number of set bits in the vector.
212int BitVector::NumSetBits() const {
213 int wordlen = WordLength();
214 int total_bits = 0;
215 for (int w = 0; w < wordlen; ++w) {
216 uinT32 word = array_[w];
217 for (int i = 0; i < 4; ++i) {
218 total_bits += hamming_table_[word & 0xff];
219 word >>= 8;
220 }
221 }
222 return total_bits;
223}
224
225// Logical in-place operations on whole bit vectors. Tries to do something
226// sensible if they aren't the same size, but they should be really.

Callers 1

LoadFromFpMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected