Skip to content

Commit 30d20f0

Browse files
committed
Cosmetic changes
1 parent 7cd5c1e commit 30d20f0

File tree

2 files changed

+11
-20
lines changed

2 files changed

+11
-20
lines changed

src/Global.hpp

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,7 @@ namespace kanzi {
9494
unsigned long res;
9595
_BitScanReverse(&res, x);
9696
return int(res);
97-
#elif defined(__GNUG__)
98-
return 31 ^ __builtin_clz(x);
99-
#elif defined(__clang__)
97+
#elif defined(__GNUG__) || defined(__clang__)
10098
return 31 ^ __builtin_clz(x);
10199
#else
102100
int res = 0;
@@ -123,9 +121,7 @@ namespace kanzi {
123121
unsigned long res;
124122
_BitScanReverse64(&res, x);
125123
return int(res);
126-
#elif defined(__GNUG__)
127-
return 63 ^ __builtin_clzll(x);
128-
#elif defined(__clang__)
124+
#elif defined(__GNUG__) || defined(__clang__)
129125
return 63 ^ __builtin_clzll(x);
130126
#else
131127
int res = 0;
@@ -157,12 +153,10 @@ namespace kanzi {
157153
unsigned long res;
158154
_BitScanForward(&res, x);
159155
return int(res);
160-
#elif defined(__GNUG__)
161-
return __builtin_ctz(x);
162-
#elif defined(__clang__)
156+
#elif defined(__GNUG__) || defined(__clang__)
163157
return __builtin_ctz(x);
164158
#else
165-
return _log2((x & (~x + 1)) - 1);
159+
return _log2(x & (~x + 1));
166160
#endif
167161
}
168162

@@ -174,12 +168,10 @@ namespace kanzi {
174168
unsigned long res;
175169
_BitScanForward64(&res, x);
176170
return int(res);
177-
#elif defined(__GNUG__)
178-
return __builtin_ctzll(x);
179-
#elif defined(__clang__)
171+
#elif defined(__GNUG__) || defined(__clang__)
180172
return __builtin_ctzll(x);
181173
#else
182-
return _log2((x & (~x + 1)) - 1);
174+
return _log2(x & (~x + 1));
183175
#endif
184176
}
185177
}

src/types.hpp

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,11 @@ limitations under the License.
2727
#endif
2828

2929

30-
#ifdef _MSC_VER
30+
#if defined(_MSC_VER)
3131
#include <intrin.h>
3232
#define popcount __popcnt
3333
#else
34-
#ifdef __INTEL_COMPILER
34+
#if defined(__INTEL_COMPILER)
3535
#include <intrin.h>
3636
#define popcount _popcnt32
3737
#else
@@ -132,7 +132,7 @@ limitations under the License.
132132
// the extra option /Zc:__cplusplus is added to the command line).
133133
// Otherwise, using the _MSVC_LANG macro returns the proper C++ version.
134134
#if __cplusplus >= 201103L
135-
// C++ 11
135+
// C++ 11 or higher
136136
#define FINAL final
137137
#define NOEXCEPT noexcept
138138
#include <cstdint>
@@ -172,10 +172,9 @@ limitations under the License.
172172
#endif
173173
#endif
174174

175-
176-
#if !defined(nullptr)
175+
#if !defined(nullptr)
177176
#define nullptr NULL
178-
#endif
177+
#endif
179178
#endif
180179

181180
#if __cplusplus >= 201703L

0 commit comments

Comments
 (0)