diff options
| author | Paul Jungeblut <paul.jungeblut@gmail.com> | 2017-11-21 10:24:13 +0100 |
|---|---|---|
| committer | Paul Jungeblut <paul.jungeblut@gmail.com> | 2017-11-21 10:24:13 +0100 |
| commit | 22150132dfb3f1736a1f3e5f87596d46bf585eff (patch) | |
| tree | 9c8893a82ca0f33508dcc738effd5bcf39c648b5 /other | |
| parent | 4557d41296204719d8f56bb3efadc38858e9f658 (diff) | |
Adding two more builtins for the number of leading 0-bits.
Diffstat (limited to 'other')
| -rw-r--r-- | other/bitOps.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/other/bitOps.cpp b/other/bitOps.cpp index 5b54278..ecb94fa 100644 --- a/other/bitOps.cpp +++ b/other/bitOps.cpp @@ -14,6 +14,9 @@ a = -1 a = (1 << n) - 1 // Iteriert über alle Teilmengen einer Bitmaske (außer der leeren Menge). for (int subset = bitmask; subset > 0; subset = (subset - 1) & bitmask) -// Zählt Anzahl der gesetzten Bits. +// Anzahl der gesetzten Bits. int __builtin_popcount(unsigned int x); int __builtin_popcountll(unsigned long long x); +// Anzahl der führenden 0-Bits. +int __builtin_clz(unsigned int x); +int __builtin_clzll(unsigned long long x); |
