MCPcopy Create free account
hub / github.com/NVIDIAGameWorks/PhysX / bitCount

Function bitCount

physx/source/foundation/include/PsBitUtils.h:42–48  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

40namespace shdfnd
41{
42PX_INLINE uint32_t bitCount(uint32_t v)
43{
44 // from http://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
45 uint32_t const w = v - ((v >> 1) & 0x55555555);
46 uint32_t const x = (w & 0x33333333) + ((w >> 2) & 0x33333333);
47 return (((x + (x >> 4)) & 0xF0F0F0F) * 0x1010101) >> 24;
48}
49
50PX_INLINE bool isPowerOfTwo(uint32_t x)
51{

Callers 3

addBodyMethod · 0.85
removeBodyMethod · 0.85
countFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected