diff options
Diffstat (limited to 'other/bitOps.cpp')
| -rw-r--r-- | other/bitOps.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/other/bitOps.cpp b/other/bitOps.cpp index 98fc994..8079305 100644 --- a/other/bitOps.cpp +++ b/other/bitOps.cpp @@ -5,9 +5,9 @@ for (int subset = bitmask; subset > 0; // Zählt Anzahl der gesetzten Bits. int numberOfSetBits(int i) { - i = i - ((i >> 1) & 0x55555555); - i = (i & 0x33333333) + ((i >> 2) & 0x33333333); - return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24; + i = i - ((i >> 1) & 0x5555'5555); + i = (i & 0x3333'3333) + ((i >> 2) & 0x3333'3333); + return (((i + (i >> 4)) & 0x0F0F'0F0F) * 0x0101'0101) >> 24; } // Nächste Permutation in Bitmaske |
