X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=glib%2Fgtypes.h;h=0e73b40b93999063a9649c66f3dd90f0a78be790;hb=4454b815367831a71b1ae00b0182b5b389a78df2;hp=ca9e50d2632ea1614b4c9c11a0f759be2e4f3b2d;hpb=34aeeb7d64a0433f7994dd2b3f60bc018f0a84c1;p=platform%2Fupstream%2Fglib.git
diff --git a/glib/gtypes.h b/glib/gtypes.h
index ca9e50d..0e73b40 100644
--- a/glib/gtypes.h
+++ b/glib/gtypes.h
@@ -12,9 +12,7 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see .
*/
/*
@@ -24,13 +22,13 @@
* GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
+#ifndef __G_TYPES_H__
+#define __G_TYPES_H__
+
#if !defined (__GLIB_H_INSIDE__) && !defined (GLIB_COMPILATION)
#error "Only can be included directly."
#endif
-#ifndef __G_TYPES_H__
-#define __G_TYPES_H__
-
#include
#include
#include
@@ -181,10 +179,16 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
/* Arch specific stuff for speed
*/
#if defined (__GNUC__) && (__GNUC__ >= 2) && defined (__OPTIMIZE__)
+
+# if __GNUC__ >= 4 && defined (__GNUC_MINOR__) && __GNUC_MINOR__ >= 3
+# define GUINT32_SWAP_LE_BE(val) ((guint32) __builtin_bswap32 ((gint32) (val)))
+# define GUINT64_SWAP_LE_BE(val) ((guint64) __builtin_bswap64 ((gint64) (val)))
+# endif
+
# if defined (__i386__)
# define GUINT16_SWAP_LE_BE_IA32(val) \
(G_GNUC_EXTENSION \
- ({ register guint16 __v, __x = ((guint16) (val)); \
+ ({ guint16 __v, __x = ((guint16) (val)); \
if (__builtin_constant_p (__x)) \
__v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \
else \
@@ -198,7 +202,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
&& !defined (__pentiumpro__) && !defined (__pentium4__)
# define GUINT32_SWAP_LE_BE_IA32(val) \
(G_GNUC_EXTENSION \
- ({ register guint32 __v, __x = ((guint32) (val)); \
+ ({ guint32 __v, __x = ((guint32) (val)); \
if (__builtin_constant_p (__x)) \
__v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
else \
@@ -212,7 +216,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
# else /* 486 and higher has bswap */
# define GUINT32_SWAP_LE_BE_IA32(val) \
(G_GNUC_EXTENSION \
- ({ register guint32 __v, __x = ((guint32) (val)); \
+ ({ guint32 __v, __x = ((guint32) (val)); \
if (__builtin_constant_p (__x)) \
__v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
else \
@@ -236,12 +240,16 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
__r.__ll; }))
/* Possibly just use the constant version and let gcc figure it out? */
# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA32 (val))
-# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA32 (val))
-# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA32 (val))
+# ifndef GUINT32_SWAP_LE_BE
+# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA32 (val))
+# endif
+# ifndef GUINT64_SWAP_LE_BE
+# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA32 (val))
+# endif
# elif defined (__ia64__)
# define GUINT16_SWAP_LE_BE_IA64(val) \
(G_GNUC_EXTENSION \
- ({ register guint16 __v, __x = ((guint16) (val)); \
+ ({ guint16 __v, __x = ((guint16) (val)); \
if (__builtin_constant_p (__x)) \
__v = GUINT16_SWAP_LE_BE_CONSTANT (__x); \
else \
@@ -252,7 +260,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
__v; }))
# define GUINT32_SWAP_LE_BE_IA64(val) \
(G_GNUC_EXTENSION \
- ({ register guint32 __v, __x = ((guint32) (val)); \
+ ({ guint32 __v, __x = ((guint32) (val)); \
if (__builtin_constant_p (__x)) \
__v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
else \
@@ -263,7 +271,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
__v; }))
# define GUINT64_SWAP_LE_BE_IA64(val) \
(G_GNUC_EXTENSION \
- ({ register guint64 __v, __x = ((guint64) (val)); \
+ ({ guint64 __v, __x = ((guint64) (val)); \
if (__builtin_constant_p (__x)) \
__v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \
else \
@@ -272,12 +280,16 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
: "r" (__x)); \
__v; }))
# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_IA64 (val))
-# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA64 (val))
-# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA64 (val))
+# ifndef GUINT32_SWAP_LE_BE
+# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_IA64 (val))
+# endif
+# ifndef GUINT64_SWAP_LE_BE
+# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_IA64 (val))
+# endif
# elif defined (__x86_64__)
# define GUINT32_SWAP_LE_BE_X86_64(val) \
(G_GNUC_EXTENSION \
- ({ register guint32 __v, __x = ((guint32) (val)); \
+ ({ guint32 __v, __x = ((guint32) (val)); \
if (__builtin_constant_p (__x)) \
__v = GUINT32_SWAP_LE_BE_CONSTANT (__x); \
else \
@@ -287,7 +299,7 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
__v; }))
# define GUINT64_SWAP_LE_BE_X86_64(val) \
(G_GNUC_EXTENSION \
- ({ register guint64 __v, __x = ((guint64) (val)); \
+ ({ guint64 __v, __x = ((guint64) (val)); \
if (__builtin_constant_p (__x)) \
__v = GUINT64_SWAP_LE_BE_CONSTANT (__x); \
else \
@@ -297,12 +309,20 @@ typedef const gchar * (*GTranslateFunc) (const gchar *str,
__v; }))
/* gcc seems to figure out optimal code for this on its own */
# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
-# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86_64 (val))
-# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86_64 (val))
+# ifndef GUINT32_SWAP_LE_BE
+# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_X86_64 (val))
+# endif
+# ifndef GUINT64_SWAP_LE_BE
+# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_X86_64 (val))
+# endif
# else /* generic gcc */
# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
-# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val))
-# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val))
+# ifndef GUINT32_SWAP_LE_BE
+# define GUINT32_SWAP_LE_BE(val) (GUINT32_SWAP_LE_BE_CONSTANT (val))
+# endif
+# ifndef GUINT64_SWAP_LE_BE
+# define GUINT64_SWAP_LE_BE(val) (GUINT64_SWAP_LE_BE_CONSTANT (val))
+# endif
# endif
#else /* generic */
# define GUINT16_SWAP_LE_BE(val) (GUINT16_SWAP_LE_BE_CONSTANT (val))
@@ -455,7 +475,7 @@ G_END_DECLS
# endif /* !GLIB_COMPILATION */
# endif /* !GLIB_STATIC_COMPILATION */
# else /* !G_PLATFORM_WIN32 */
-# define GLIB_VAR extern
+# define GLIB_VAR _GLIB_EXTERN
# endif /* !G_PLATFORM_WIN32 */
#endif /* GLIB_VAR */