summaryrefslogtreecommitdiff
path: root/other/bitOps.cpp
diff options
context:
space:
mode:
authormzuenni <michi.zuendorf@gmail.com>2023-03-28 13:25:59 +0200
committermzuenni <michi.zuendorf@gmail.com>2023-03-28 13:25:59 +0200
commitfe5fa1141efeb7454c763dbd2645fb4ff04487a3 (patch)
treef2197bb94ce80ab2fae886177dfa9b0bd11538ac /other/bitOps.cpp
parent3b91d2662310aee532cc84e1447824459671767e (diff)
merged
Diffstat (limited to 'other/bitOps.cpp')
-rw-r--r--other/bitOps.cpp6
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