2 /* { dg-require-effective-target stdint_types } */
3 /* { dg-options "-Wall" } */
7 #define MAKE_FUN(suffix, type) \
8 type my_bswap##suffix(type x) { \
11 for (shift = 0; shift < 8 * sizeof (type); shift += 8) \
14 result |= (x >> shift) & 0xff; \
19 MAKE_FUN(32, uint32_t);
20 MAKE_FUN(64, uint64_t);
22 extern void abort (void);
33 0x0000000000000000ULL, \
34 0x1122334455667788ULL, \
35 0xffffffffffffffffULL, \
38 uint32_t uint32_ts
[] =
41 uint64_t uint64_ts
[] =
44 #define N(table) (sizeof (table) / sizeof (table[0]))
51 for (i
= 0; i
< N(uint32_ts
); i
++)
52 if (__builtin_bswap32 (uint32_ts
[i
]) != my_bswap32 (uint32_ts
[i
]))
55 for (i
= 0; i
< N(uint64_ts
); i
++)
56 if (__builtin_bswap64 (uint64_ts
[i
]) != my_bswap64 (uint64_ts
[i
]))