| 40 | namespace shdfnd |
| 41 | { |
| 42 | PX_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 | |
| 50 | PX_INLINE bool isPowerOfTwo(uint32_t x) |
| 51 | { |
no outgoing calls
no test coverage detected