MCPcopy Create free account
hub / github.com/ARM-software/astc-encoder / popcount

Function popcount

Source/astcenc_vecmathlib_common_4.h:342–354  ·  view source on GitHub ↗

* @brief Population bit count. * * @param v The value to population count. * * @return The number of 1 bits. */

Source from the content-addressed store, hash-verified

340 * @return The number of 1 bits.
341 */
342static inline int popcount(uint64_t v)
343{
344 uint64_t mask1 = 0x5555555555555555ULL;
345 uint64_t mask2 = 0x3333333333333333ULL;
346 uint64_t mask3 = 0x0F0F0F0F0F0F0F0FULL;
347 v -= (v >> 1) & mask1;
348 v = (v & mask2) + ((v >> 2) & mask2);
349 v += v >> 4;
350 v &= mask3;
351 v *= 0x0101010101010101ULL;
352 v >>= 56;
353 return static_cast<int>(v);
354}
355
356#endif
357

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected