+2008-07-24 Pavel Roskin <proski@gnu.org>
+
+ * include/grub/types.h: Use __builtin_bswap32() and
+ __builtin_bswap64() with gcc 4.3 and newer.
+
2008-07-24 Christian Franke <franke@computer.org>
* util/i386/pc/grub-install.in: If `--debug' is specified,
(grub_uint16_t) ((_x << 8) | (_x >> 8)); \
})
+#if defined(__GNUC__) && (__GNUC__ > 3) && (__GNUC__ > 4 || __GNUC_MINOR__ >= 3)
+static inline grub_uint32_t grub_swap_bytes32(grub_uint32_t x)
+{
+ return __builtin_bswap32(x);
+}
+
+static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
+{
+ return __builtin_bswap64(x);
+}
+#else /* not gcc 4.3 or newer */
#define grub_swap_bytes32(x) \
({ \
grub_uint32_t _x = (x); \
| ((_x & (grub_uint64_t) 0xFF000000000000ULL) >> 40) \
| (_x >> 56)); \
})
+#endif /* not gcc 4.3 or newer */
#ifdef GRUB_CPU_WORDS_BIGENDIAN
# define grub_cpu_to_le16(x) grub_swap_bytes16(x)