commit-grub
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[1731] 2008-07-24 Pavel Roskin <address@hidden>


From: Pavel Roskin
Subject: [1731] 2008-07-24 Pavel Roskin <address@hidden>
Date: Thu, 24 Jul 2008 23:36:14 +0000

Revision: 1731
          http://svn.sv.gnu.org/viewvc/?view=rev&root=grub&revision=1731
Author:   proski
Date:     2008-07-24 23:36:13 +0000 (Thu, 24 Jul 2008)

Log Message:
-----------
2008-07-24  Pavel Roskin  <address@hidden>

        * include/grub/types.h: Use __builtin_bswap32() and
        __builtin_bswap64() with gcc 4.3 and newer.

Modified Paths:
--------------
    trunk/grub2/ChangeLog
    trunk/grub2/include/grub/types.h

Modified: trunk/grub2/ChangeLog
===================================================================
--- trunk/grub2/ChangeLog       2008-07-24 19:40:05 UTC (rev 1730)
+++ trunk/grub2/ChangeLog       2008-07-24 23:36:13 UTC (rev 1731)
@@ -1,3 +1,8 @@
+2008-07-24  Pavel Roskin  <address@hidden>
+
+       * include/grub/types.h: Use __builtin_bswap32() and
+       __builtin_bswap64() with gcc 4.3 and newer.
+
 2008-07-24  Christian Franke  <address@hidden>
 
        * util/i386/pc/grub-install.in: If `--debug' is specified,

Modified: trunk/grub2/include/grub/types.h
===================================================================
--- trunk/grub2/include/grub/types.h    2008-07-24 19:40:05 UTC (rev 1730)
+++ trunk/grub2/include/grub/types.h    2008-07-24 23:36:13 UTC (rev 1731)
@@ -111,6 +111,17 @@
    (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); \
@@ -132,6 +143,7 @@
                     | ((_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)






reply via email to

[Prev in Thread] Current Thread [Next in Thread]