@@ -274,6 +274,7 @@ namespace SourceLocation {
274
274
}
275
275
}
276
276
277
+ #define BITSIZE (x ) (sizeof (x) * 8 )
277
278
namespace popcount {
278
279
static_assert (__builtin_popcount(~0u ) == __CHAR_BIT__ * sizeof (unsigned int ), " " );
279
280
static_assert (__builtin_popcount(0 ) == 0 , " " );
@@ -283,7 +284,6 @@ namespace popcount {
283
284
static_assert (__builtin_popcountll(0 ) == 0 , " " );
284
285
285
286
// / From test/Sema/constant-builtins-2.c
286
- #define BITSIZE (x ) (sizeof (x) * 8 )
287
287
char popcount1[__builtin_popcount(0 ) == 0 ? 1 : -1 ];
288
288
char popcount2[__builtin_popcount(0xF0F0 ) == 8 ? 1 : -1 ];
289
289
char popcount3[__builtin_popcount(~0 ) == BITSIZE(int ) ? 1 : -1 ];
@@ -295,3 +295,18 @@ namespace popcount {
295
295
char popcount9[__builtin_popcountll(0xF0F0LL ) == 8 ? 1 : -1 ];
296
296
char popcount10[__builtin_popcountll(~0LL ) == BITSIZE(long long ) ? 1 : -1 ];
297
297
}
298
+
299
+ namespace parity {
300
+ // / From test/Sema/constant-builtins-2.c
301
+ char parity1[__builtin_parity(0 ) == 0 ? 1 : -1 ];
302
+ char parity2[__builtin_parity(0xb821 ) == 0 ? 1 : -1 ];
303
+ char parity3[__builtin_parity(0xb822 ) == 0 ? 1 : -1 ];
304
+ char parity4[__builtin_parity(0xb823 ) == 1 ? 1 : -1 ];
305
+ char parity5[__builtin_parity(0xb824 ) == 0 ? 1 : -1 ];
306
+ char parity6[__builtin_parity(0xb825 ) == 1 ? 1 : -1 ];
307
+ char parity7[__builtin_parity(0xb826 ) == 1 ? 1 : -1 ];
308
+ char parity8[__builtin_parity(~0 ) == 0 ? 1 : -1 ];
309
+ char parity9[__builtin_parityl(1L << (BITSIZE(long ) - 1 )) == 1 ? 1 : -1 ];
310
+ char parity10[__builtin_parityll(1LL << (BITSIZE(long long ) - 1 )) == 1 ? 1 : -1 ];
311
+ }
312
+
0 commit comments