use __extension__ for long long on gcc >= 2.8 and egcs, and provide a
authorManish Singh <yosh@src.gnome.org>
Wed, 11 Nov 1998 01:26:10 +0000 (01:26 +0000)
committerManish Singh <yosh@src.gnome.org>
Wed, 11 Nov 1998 01:26:10 +0000 (01:26 +0000)
* configure.in: use __extension__ for long long on gcc >= 2.8 and
egcs, and provide a G_GINT64_CONSTANT wrapper so -ansi -pedantic
compiles clean.

* glib.h: make the endian x86 asm __const__ so the compiler can do
better optimizations. Also remove the cc clobber, these shouldn't
be changing condition codes. Ditch some redundant casts. Add an
optimization for 64-bit endian conversions in x86. Use constant
wrapper for the generic method.

* testglib.c: use constant wrappers for 64-bit constants

-Yosh

13 files changed:
ChangeLog
ChangeLog.pre-2-0
ChangeLog.pre-2-10
ChangeLog.pre-2-12
ChangeLog.pre-2-2
ChangeLog.pre-2-4
ChangeLog.pre-2-6
ChangeLog.pre-2-8
configure.in
glib.h
glib/glib.h
testglib.c
tests/testglib.c

index f89a573..bfa281c 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,17 @@
+Tue Nov 10 17:12:45 PST 1998 Manish Singh <yosh@gimp.org>
+
+       * configure.in: use __extension__ for long long on gcc >= 2.8 and
+       egcs, and provide a G_GINT64_CONSTANT wrapper so -ansi -pedantic
+       compiles clean.
+
+       * glib.h: make the endian x86 asm __const__ so the compiler can do
+       better optimizations. Also remove the cc clobber, these shouldn't
+       be changing condition codes. Ditch some redundant casts. Add an
+       optimization for 64-bit endian conversions in x86. Use constant
+       wrapper for the generic method.
+
+       * testglib.c: use constant wrappers for 64-bit constants
+
 1998-11-04  Phil Schwan  <pschwan@cmu.edu>
 
        * configure.in: Added 'strncasecmp' to the list of functions to be
index f89a573..bfa281c 100644 (file)
@@ -1,3 +1,17 @@
+Tue Nov 10 17:12:45 PST 1998 Manish Singh <yosh@gimp.org>
+
+       * configure.in: use __extension__ for long long on gcc >= 2.8 and
+       egcs, and provide a G_GINT64_CONSTANT wrapper so -ansi -pedantic
+       compiles clean.
+
+       * glib.h: make the endian x86 asm __const__ so the compiler can do
+       better optimizations. Also remove the cc clobber, these shouldn't
+       be changing condition codes. Ditch some redundant casts. Add an
+       optimization for 64-bit endian conversions in x86. Use constant
+       wrapper for the generic method.
+
+       * testglib.c: use constant wrappers for 64-bit constants
+
 1998-11-04  Phil Schwan  <pschwan@cmu.edu>
 
        * configure.in: Added 'strncasecmp' to the list of functions to be
index f89a573..bfa281c 100644 (file)
@@ -1,3 +1,17 @@
+Tue Nov 10 17:12:45 PST 1998 Manish Singh <yosh@gimp.org>
+
+       * configure.in: use __extension__ for long long on gcc >= 2.8 and
+       egcs, and provide a G_GINT64_CONSTANT wrapper so -ansi -pedantic
+       compiles clean.
+
+       * glib.h: make the endian x86 asm __const__ so the compiler can do
+       better optimizations. Also remove the cc clobber, these shouldn't
+       be changing condition codes. Ditch some redundant casts. Add an
+       optimization for 64-bit endian conversions in x86. Use constant
+       wrapper for the generic method.
+
+       * testglib.c: use constant wrappers for 64-bit constants
+
 1998-11-04  Phil Schwan  <pschwan@cmu.edu>
 
        * configure.in: Added 'strncasecmp' to the list of functions to be
index f89a573..bfa281c 100644 (file)
@@ -1,3 +1,17 @@
+Tue Nov 10 17:12:45 PST 1998 Manish Singh <yosh@gimp.org>
+
+       * configure.in: use __extension__ for long long on gcc >= 2.8 and
+       egcs, and provide a G_GINT64_CONSTANT wrapper so -ansi -pedantic
+       compiles clean.
+
+       * glib.h: make the endian x86 asm __const__ so the compiler can do
+       better optimizations. Also remove the cc clobber, these shouldn't
+       be changing condition codes. Ditch some redundant casts. Add an
+       optimization for 64-bit endian conversions in x86. Use constant
+       wrapper for the generic method.
+
+       * testglib.c: use constant wrappers for 64-bit constants
+
 1998-11-04  Phil Schwan  <pschwan@cmu.edu>
 
        * configure.in: Added 'strncasecmp' to the list of functions to be
index f89a573..bfa281c 100644 (file)
@@ -1,3 +1,17 @@
+Tue Nov 10 17:12:45 PST 1998 Manish Singh <yosh@gimp.org>
+
+       * configure.in: use __extension__ for long long on gcc >= 2.8 and
+       egcs, and provide a G_GINT64_CONSTANT wrapper so -ansi -pedantic
+       compiles clean.
+
+       * glib.h: make the endian x86 asm __const__ so the compiler can do
+       better optimizations. Also remove the cc clobber, these shouldn't
+       be changing condition codes. Ditch some redundant casts. Add an
+       optimization for 64-bit endian conversions in x86. Use constant
+       wrapper for the generic method.
+
+       * testglib.c: use constant wrappers for 64-bit constants
+
 1998-11-04  Phil Schwan  <pschwan@cmu.edu>
 
        * configure.in: Added 'strncasecmp' to the list of functions to be
index f89a573..bfa281c 100644 (file)
@@ -1,3 +1,17 @@
+Tue Nov 10 17:12:45 PST 1998 Manish Singh <yosh@gimp.org>
+
+       * configure.in: use __extension__ for long long on gcc >= 2.8 and
+       egcs, and provide a G_GINT64_CONSTANT wrapper so -ansi -pedantic
+       compiles clean.
+
+       * glib.h: make the endian x86 asm __const__ so the compiler can do
+       better optimizations. Also remove the cc clobber, these shouldn't
+       be changing condition codes. Ditch some redundant casts. Add an
+       optimization for 64-bit endian conversions in x86. Use constant
+       wrapper for the generic method.
+
+       * testglib.c: use constant wrappers for 64-bit constants
+
 1998-11-04  Phil Schwan  <pschwan@cmu.edu>
 
        * configure.in: Added 'strncasecmp' to the list of functions to be
index f89a573..bfa281c 100644 (file)
@@ -1,3 +1,17 @@
+Tue Nov 10 17:12:45 PST 1998 Manish Singh <yosh@gimp.org>
+
+       * configure.in: use __extension__ for long long on gcc >= 2.8 and
+       egcs, and provide a G_GINT64_CONSTANT wrapper so -ansi -pedantic
+       compiles clean.
+
+       * glib.h: make the endian x86 asm __const__ so the compiler can do
+       better optimizations. Also remove the cc clobber, these shouldn't
+       be changing condition codes. Ditch some redundant casts. Add an
+       optimization for 64-bit endian conversions in x86. Use constant
+       wrapper for the generic method.
+
+       * testglib.c: use constant wrappers for 64-bit constants
+
 1998-11-04  Phil Schwan  <pschwan@cmu.edu>
 
        * configure.in: Added 'strncasecmp' to the list of functions to be
index f89a573..bfa281c 100644 (file)
@@ -1,3 +1,17 @@
+Tue Nov 10 17:12:45 PST 1998 Manish Singh <yosh@gimp.org>
+
+       * configure.in: use __extension__ for long long on gcc >= 2.8 and
+       egcs, and provide a G_GINT64_CONSTANT wrapper so -ansi -pedantic
+       compiles clean.
+
+       * glib.h: make the endian x86 asm __const__ so the compiler can do
+       better optimizations. Also remove the cc clobber, these shouldn't
+       be changing condition codes. Ditch some redundant casts. Add an
+       optimization for 64-bit endian conversions in x86. Use constant
+       wrapper for the generic method.
+
+       * testglib.c: use constant wrappers for 64-bit constants
+
 1998-11-04  Phil Schwan  <pschwan@cmu.edu>
 
        * configure.in: Added 'strncasecmp' to the list of functions to be
index 40eb7e5..f8c28ad 100644 (file)
@@ -584,9 +584,12 @@ outfile_EOF
   fi 
   if test -n "$gint64"; then
     cat >>$outfile <<outfile_EOF
-#define G_HAVE_GINT64 1
-typedef signed $gint64 gint64;
-typedef unsigned $gint64 guint64;
+${glib_warning_guard}#define G_HAVE_GINT64 1
+
+${glib_extension}typedef signed $gint64 gint64;
+${glib_extension}typedef unsigned $gint64 guint64;
+
+#define G_GINT64_CONSTANT(val) $gint64_constant
 outfile_EOF
   fi 
 
@@ -703,9 +706,31 @@ $ac_cv_sizeof_int)         gint32=int;;
 $ac_cv_sizeof_long)            gint32=long;;
 esac
 case 8 in
-$ac_cv_sizeof_int)             gint64=int;;
-$ac_cv_sizeof_long)            gint64=long;;
-$ac_cv_sizeof_long_long)       gint64='long long';;
+$ac_cv_sizeof_int)
+  gint64=int
+  glib_extension=
+  glib_warning_guard=
+  gint64_constant='(val)'
+  ;;
+$ac_cv_sizeof_long)
+  gint64=long
+  glib_extension=
+  glib_warning_guard=
+  gint64_constant='(val##L)'
+  ;;
+$ac_cv_sizeof_long_long)
+  gint64='long long'
+  glib_extension='GLIB_WARNINGS_MAKE_PEOPLE_CRY '
+  glib_warning_guard="
+#if defined (__GNUC__) && __GNUC__ >= 2 && __GNUC_MINOR__ >= 8
+#  define GLIB_WARNINGS_MAKE_PEOPLE_CRY __extension__
+#else
+#  define GLIB_WARNINGS_MAKE_PEOPLE_CRY
+#endif
+
+"
+  gint64_constant='(GLIB_WARNINGS_MAKE_PEOPLE_CRY (val##LL))'
+  ;;
 esac
 
 gintbits=`expr $ac_cv_sizeof_int \* 8`
diff --git a/glib.h b/glib.h
index 9e93836..9f6c517 100644 (file)
--- a/glib.h
+++ b/glib.h
@@ -301,9 +301,9 @@ extern "C" {
 /* Hacker macro to place breakpoints for x86 machines.
  * Actual use is strongly deprecated of course ;)
  */
-#if defined (__i386__) && defined (__GNUC__)
+#if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
 #define        G_BREAKPOINT()          G_STMT_START{ __asm__ __volatile__ ("int $03"); }G_STMT_END
-#elif defined (__alpha__) && defined (__GNUC__)
+#elif defined (__alpha__) && defined (__GNUC__) && __GNUC__ >= 2
 #define        G_BREAKPOINT()          G_STMT_START{ __asm__ __volatile__ ("bpt"); }G_STMT_END
 #else  /* !__i386__ && !__alpha__ */
 #define        G_BREAKPOINT()
@@ -533,37 +533,34 @@ typedef gint32    GTime;
 
 /* Intel specific stuff for speed
  */
-#if defined (__i386__) && (defined __GNUC__)
+#if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
 
 #  define GUINT16_SWAP_LE_BE_X86(val) \
-     (__extension__                                            \
-      ({ register guint16 __v;                                 \
-        if (__builtin_constant_p (val))                        \
-          __v = GUINT16_SWAP_LE_BE_CONSTANT (val);             \
-        else                                                   \
-          __asm__ __volatile__ ("rorw $8, %w0"                 \
-                                : "=r" (__v)                   \
-                                : "0" ((guint16) (val))        \
-                                : "cc");                       \
+     (__extension__                                    \
+      ({ register guint16 __v;                         \
+        if (__builtin_constant_p (val))                \
+          __v = GUINT16_SWAP_LE_BE_CONSTANT (val);     \
+        else                                           \
+          __asm__ __const__ ("rorw $8, %w0"            \
+                             : "=r" (__v)              \
+                             : "0" ((guint16) (val))); \
        __v; }))
 
-#  define GUINT16_SWAP_LE_BE(val) \
-     ((guint16) GUINT16_SWAP_LE_BE_X86 ((guint16) (val)))
+#  define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_X86 (val))
 
 #  if !defined(__i486__) && !defined(__i586__) \
-      && !defined(__pentium__) && !defined(__pentiumpro__) && !defined(__i686__)
+      && !defined(__pentium__) && !defined(__i686__) && !defined(__pentiumpro__)
 #     define GUINT32_SWAP_LE_BE_X86(val) \
         (__extension__                                         \
          ({ register guint32 __v;                              \
            if (__builtin_constant_p (val))                     \
              __v = GUINT32_SWAP_LE_BE_CONSTANT (val);          \
          else                                                  \
-           __asm__ __volatile__ ("rorw $8, %w0\n\t"            \
-                                 "rorl $16, %0\n\t"            \
-                                 "rorw $8, %w0"                \
-                                 : "=r" (__v)                  \
-                                 : "0" ((guint32) (val))       \
-                                 : "cc");                      \
+           __asm__ __const__ ("rorw $8, %w0\n\t"               \
+                              "rorl $16, %0\n\t"               \
+                              "rorw $8, %w0"                   \
+                              : "=r" (__v)                     \
+                              : "0" ((guint32) (val)));        \
        __v; }))
 
 #  else /* 486 and higher has bswap */
@@ -573,14 +570,13 @@ typedef gint32    GTime;
            if (__builtin_constant_p (val))                     \
              __v = GUINT32_SWAP_LE_BE_CONSTANT (val);          \
          else                                                  \
-           __asm__ __volatile__ ("bswap %0"                    \
-                                 : "=r" (__v)                  \
-                                 : "0" ((guint32) (val)));     \
+           __asm__ __const__ ("bswap %0"                       \
+                              : "=r" (__v)                     \
+                              : "0" ((guint32) (val)));        \
        __v; }))
 #  endif /* processor specific 32-bit stuff */
 
-#  define GUINT32_SWAP_LE_BE(val) \
-     ((guint32) GUINT32_SWAP_LE_BE_X86 ((guint32) (val)))
+#  define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86 (val))
 
 #else /* !__i386__ */
 #  define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
@@ -588,15 +584,46 @@ typedef gint32    GTime;
 #endif /* __i386__ */
 
 #ifdef G_HAVE_GINT64
-#define GUINT64_SWAP_LE_BE(val)         ((guint64) ( \
-    (((guint64) (val) & (guint64) 0x00000000000000ffU) << 56) | \
-    (((guint64) (val) & (guint64) 0x000000000000ff00U) << 40) | \
-    (((guint64) (val) & (guint64) 0x0000000000ff0000U) << 24) | \
-    (((guint64) (val) & (guint64) 0x00000000ff000000U) <<  8) | \
-    (((guint64) (val) & (guint64) 0x000000ff00000000U) >>  8) | \
-    (((guint64) (val) & (guint64) 0x0000ff0000000000U) >> 24) | \
-    (((guint64) (val) & (guint64) 0x00ff000000000000U) >> 40) | \
-    (((guint64) (val) & (guint64) 0xff00000000000000U) >> 56)))
+#  define GUINT64_SWAP_LE_BE_CONSTANT(val)     ((guint64) ( \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0x00000000000000ffU)) << 56) |      \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0x000000000000ff00U)) << 40) |      \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0x0000000000ff0000U)) << 24) |      \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0x00000000ff000000U)) <<  8) |      \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0x000000ff00000000U)) >>  8) |      \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0x0000ff0000000000U)) >> 24) |      \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0x00ff000000000000U)) >> 40) |      \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0xff00000000000000U)) >> 56)))
+
+#  if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
+#    define GUINT64_SWAP_LE_BE_X86(val) \
+       (__extension__                                          \
+        ({ union { guint64 __ll;                               \
+                   guint32 __l[2]; } __r;                      \
+           if (__builtin_constant_p (val))                     \
+             __r.__ll = GUINT64_SWAP_LE_BE_CONSTANT (val);     \
+           else                                                \
+             {                                                 \
+               union { guint64 __ll;                           \
+                       guint32 __l[2]; } __w;                  \
+               __w.__ll = ((guint64) val);                     \
+               __r.__l[0] = GUINT32_SWAP_LE_BE (__w.__l[1]);   \
+               __r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]);   \
+             }                                                 \
+         __r.__ll; }))
+
+#    define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86 (val))
+
+#  else /* !__i386__ */
+#    define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT(val))
+#  endif
 #endif
 
 #define GUINT16_SWAP_LE_PDP(val)       ((guint16) (val))
index 9e93836..9f6c517 100644 (file)
@@ -301,9 +301,9 @@ extern "C" {
 /* Hacker macro to place breakpoints for x86 machines.
  * Actual use is strongly deprecated of course ;)
  */
-#if defined (__i386__) && defined (__GNUC__)
+#if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
 #define        G_BREAKPOINT()          G_STMT_START{ __asm__ __volatile__ ("int $03"); }G_STMT_END
-#elif defined (__alpha__) && defined (__GNUC__)
+#elif defined (__alpha__) && defined (__GNUC__) && __GNUC__ >= 2
 #define        G_BREAKPOINT()          G_STMT_START{ __asm__ __volatile__ ("bpt"); }G_STMT_END
 #else  /* !__i386__ && !__alpha__ */
 #define        G_BREAKPOINT()
@@ -533,37 +533,34 @@ typedef gint32    GTime;
 
 /* Intel specific stuff for speed
  */
-#if defined (__i386__) && (defined __GNUC__)
+#if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
 
 #  define GUINT16_SWAP_LE_BE_X86(val) \
-     (__extension__                                            \
-      ({ register guint16 __v;                                 \
-        if (__builtin_constant_p (val))                        \
-          __v = GUINT16_SWAP_LE_BE_CONSTANT (val);             \
-        else                                                   \
-          __asm__ __volatile__ ("rorw $8, %w0"                 \
-                                : "=r" (__v)                   \
-                                : "0" ((guint16) (val))        \
-                                : "cc");                       \
+     (__extension__                                    \
+      ({ register guint16 __v;                         \
+        if (__builtin_constant_p (val))                \
+          __v = GUINT16_SWAP_LE_BE_CONSTANT (val);     \
+        else                                           \
+          __asm__ __const__ ("rorw $8, %w0"            \
+                             : "=r" (__v)              \
+                             : "0" ((guint16) (val))); \
        __v; }))
 
-#  define GUINT16_SWAP_LE_BE(val) \
-     ((guint16) GUINT16_SWAP_LE_BE_X86 ((guint16) (val)))
+#  define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_X86 (val))
 
 #  if !defined(__i486__) && !defined(__i586__) \
-      && !defined(__pentium__) && !defined(__pentiumpro__) && !defined(__i686__)
+      && !defined(__pentium__) && !defined(__i686__) && !defined(__pentiumpro__)
 #     define GUINT32_SWAP_LE_BE_X86(val) \
         (__extension__                                         \
          ({ register guint32 __v;                              \
            if (__builtin_constant_p (val))                     \
              __v = GUINT32_SWAP_LE_BE_CONSTANT (val);          \
          else                                                  \
-           __asm__ __volatile__ ("rorw $8, %w0\n\t"            \
-                                 "rorl $16, %0\n\t"            \
-                                 "rorw $8, %w0"                \
-                                 : "=r" (__v)                  \
-                                 : "0" ((guint32) (val))       \
-                                 : "cc");                      \
+           __asm__ __const__ ("rorw $8, %w0\n\t"               \
+                              "rorl $16, %0\n\t"               \
+                              "rorw $8, %w0"                   \
+                              : "=r" (__v)                     \
+                              : "0" ((guint32) (val)));        \
        __v; }))
 
 #  else /* 486 and higher has bswap */
@@ -573,14 +570,13 @@ typedef gint32    GTime;
            if (__builtin_constant_p (val))                     \
              __v = GUINT32_SWAP_LE_BE_CONSTANT (val);          \
          else                                                  \
-           __asm__ __volatile__ ("bswap %0"                    \
-                                 : "=r" (__v)                  \
-                                 : "0" ((guint32) (val)));     \
+           __asm__ __const__ ("bswap %0"                       \
+                              : "=r" (__v)                     \
+                              : "0" ((guint32) (val)));        \
        __v; }))
 #  endif /* processor specific 32-bit stuff */
 
-#  define GUINT32_SWAP_LE_BE(val) \
-     ((guint32) GUINT32_SWAP_LE_BE_X86 ((guint32) (val)))
+#  define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86 (val))
 
 #else /* !__i386__ */
 #  define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
@@ -588,15 +584,46 @@ typedef gint32    GTime;
 #endif /* __i386__ */
 
 #ifdef G_HAVE_GINT64
-#define GUINT64_SWAP_LE_BE(val)         ((guint64) ( \
-    (((guint64) (val) & (guint64) 0x00000000000000ffU) << 56) | \
-    (((guint64) (val) & (guint64) 0x000000000000ff00U) << 40) | \
-    (((guint64) (val) & (guint64) 0x0000000000ff0000U) << 24) | \
-    (((guint64) (val) & (guint64) 0x00000000ff000000U) <<  8) | \
-    (((guint64) (val) & (guint64) 0x000000ff00000000U) >>  8) | \
-    (((guint64) (val) & (guint64) 0x0000ff0000000000U) >> 24) | \
-    (((guint64) (val) & (guint64) 0x00ff000000000000U) >> 40) | \
-    (((guint64) (val) & (guint64) 0xff00000000000000U) >> 56)))
+#  define GUINT64_SWAP_LE_BE_CONSTANT(val)     ((guint64) ( \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0x00000000000000ffU)) << 56) |      \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0x000000000000ff00U)) << 40) |      \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0x0000000000ff0000U)) << 24) |      \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0x00000000ff000000U)) <<  8) |      \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0x000000ff00000000U)) >>  8) |      \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0x0000ff0000000000U)) >> 24) |      \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0x00ff000000000000U)) >> 40) |      \
+      (((guint64) (val) &                                              \
+       (guint64) G_GINT64_CONSTANT(0xff00000000000000U)) >> 56)))
+
+#  if defined (__i386__) && defined (__GNUC__) && __GNUC__ >= 2
+#    define GUINT64_SWAP_LE_BE_X86(val) \
+       (__extension__                                          \
+        ({ union { guint64 __ll;                               \
+                   guint32 __l[2]; } __r;                      \
+           if (__builtin_constant_p (val))                     \
+             __r.__ll = GUINT64_SWAP_LE_BE_CONSTANT (val);     \
+           else                                                \
+             {                                                 \
+               union { guint64 __ll;                           \
+                       guint32 __l[2]; } __w;                  \
+               __w.__ll = ((guint64) val);                     \
+               __r.__l[0] = GUINT32_SWAP_LE_BE (__w.__l[1]);   \
+               __r.__l[1] = GUINT32_SWAP_LE_BE (__w.__l[0]);   \
+             }                                                 \
+         __r.__ll; }))
+
+#    define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86 (val))
+
+#  else /* !__i386__ */
+#    define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT(val))
+#  endif
 #endif
 
 #define GUINT16_SWAP_LE_PDP(val)       ((guint16) (val))
index 3a20d62..6a76389 100644 (file)
@@ -324,7 +324,8 @@ main (int   argc,
   guint16 gu16t1 = 0x44afU, gu16t2 = 0xaf44U;
   guint32 gu32t1 = 0x02a7f109U, gu32t2 = 0x09f1a702U;
 #ifdef G_HAVE_GINT64
-  guint64 gu64t1 = 0x1d636b02300a7aa7U, gu64t2 = 0xa77a0a30026b631dU;
+  guint64 gu64t1 = G_GINT64_CONSTANT(0x1d636b02300a7aa7U),
+         gu64t2 = G_GINT64_CONSTANT(0xa77a0a30026b631dU);
 #endif
 
   g_print ("TestGLib v%u.%u.%u (i:%u b:%u)\n",
index 3a20d62..6a76389 100644 (file)
@@ -324,7 +324,8 @@ main (int   argc,
   guint16 gu16t1 = 0x44afU, gu16t2 = 0xaf44U;
   guint32 gu32t1 = 0x02a7f109U, gu32t2 = 0x09f1a702U;
 #ifdef G_HAVE_GINT64
-  guint64 gu64t1 = 0x1d636b02300a7aa7U, gu64t2 = 0xa77a0a30026b631dU;
+  guint64 gu64t1 = G_GINT64_CONSTANT(0x1d636b02300a7aa7U),
+         gu64t2 = G_GINT64_CONSTANT(0xa77a0a30026b631dU);
 #endif
 
   g_print ("TestGLib v%u.%u.%u (i:%u b:%u)\n",