summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/lib/eina/eina_config.h.in34
-rw-r--r--src/lib/eina/eina_inline_cpu.x14
2 files changed, 11 insertions, 37 deletions
diff --git a/src/lib/eina/eina_config.h.in b/src/lib/eina/eina_config.h.in
index 7f81542..8728bb4 100644
--- a/src/lib/eina/eina_config.h.in
+++ b/src/lib/eina/eina_config.h.in
@@ -23,14 +23,6 @@
23# include <Exotic.h> 23# include <Exotic.h>
24#endif 24#endif
25 25
26#ifdef __has_builtin
27# define EINA_HAS_BUILTIN(x) __has_builtin(x)
28#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))
29# define EINA_HAS_BUILTIN(x) 1
30#else
31# define EINA_HAS_BUILTIN(x) 0 // Compatibility for the rest of the world
32#endif
33
34#ifdef EINA_MAGIC_DEBUG 26#ifdef EINA_MAGIC_DEBUG
35# undef EINA_MAGIC_DEBUG 27# undef EINA_MAGIC_DEBUG
36#endif 28#endif
@@ -95,32 +87,6 @@
95#endif 87#endif
96@EINA_CONFIGURE_HAVE_ALLOCA_H@ 88@EINA_CONFIGURE_HAVE_ALLOCA_H@
97 89
98#ifdef EINA_HAVE_BSWAP16
99# undef EINA_HAVE_BSWAP16
100#endif
101#if EINA_HAS_BUILTIN(__builtin_bswap16)
102# define EINA_HAVE_BSWAP16
103#endif
104
105#ifdef EINA_HAVE_BSWAP32
106# undef EINA_HAVE_BSWAP32
107#endif
108#if EINA_HAS_BUILTIN(__builtin_bswap32)
109# define EINA_HAVE_BSWAP32
110#endif
111
112#ifdef EINA_HAVE_BSWAP64
113# undef EINA_HAVE_BSWAP64
114#endif
115#if EINA_HAS_BUILTIN(__builtin_bswap64)
116# define EINA_HAVE_BSWAP64
117#endif
118
119#ifdef EINA_HAVE_BYTESWAP_H
120# undef EINA_HAVE_BYTESWAP_H
121#endif
122@EINA_CONFIGURE_HAVE_BYTESWAP_H@
123
124#ifdef EINA_HAVE_POSIX_SPINLOCK 90#ifdef EINA_HAVE_POSIX_SPINLOCK
125# undef EINA_HAVE_POSIX_SPINLOCK 91# undef EINA_HAVE_POSIX_SPINLOCK
126#endif 92#endif
diff --git a/src/lib/eina/eina_inline_cpu.x b/src/lib/eina/eina_inline_cpu.x
index 0dd293c..da10760 100644
--- a/src/lib/eina/eina_inline_cpu.x
+++ b/src/lib/eina/eina_inline_cpu.x
@@ -23,6 +23,14 @@
23#ifndef EINA_INLINE_CPU_X_ 23#ifndef EINA_INLINE_CPU_X_
24#define EINA_INLINE_CPU_X_ 24#define EINA_INLINE_CPU_X_
25 25
26#ifdef __has_builtin
27# define EINA_HAS_BUILTIN(x) __has_builtin(x)
28#elif (defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 8)))
29# define EINA_HAS_BUILTIN(x) 1
30#else
31# define EINA_HAS_BUILTIN(x) 0 // Compatibility for the rest of the world
32#endif
33
26#ifdef EINA_HAVE_BYTESWAP_H 34#ifdef EINA_HAVE_BYTESWAP_H
27# include <byteswap.h> 35# include <byteswap.h>
28#endif 36#endif
@@ -30,7 +38,7 @@
30static inline unsigned short 38static inline unsigned short
31eina_swap16(unsigned short x) 39eina_swap16(unsigned short x)
32{ 40{
33#if defined EINA_HAVE_BSWAP16 41#if EINA_HAS_BUILTIN(__builtin_bswap16)
34 return __builtin_bswap16(x); 42 return __builtin_bswap16(x);
35#elif defined _MSC_VER /* Windows. Apparently in <stdlib.h>. */ 43#elif defined _MSC_VER /* Windows. Apparently in <stdlib.h>. */
36 return _byteswap_ushort(x); 44 return _byteswap_ushort(x);
@@ -45,7 +53,7 @@ eina_swap16(unsigned short x)
45static inline unsigned int 53static inline unsigned int
46eina_swap32(unsigned int x) 54eina_swap32(unsigned int x)
47{ 55{
48#ifdef EINA_HAVE_BSWAP32 56#if EINA_HAS_BUILTIN(__builtin_bswap32)
49 return __builtin_bswap32(x); 57 return __builtin_bswap32(x);
50#elif defined _MSC_VER /* Windows. Apparently in <stdlib.h>. */ 58#elif defined _MSC_VER /* Windows. Apparently in <stdlib.h>. */
51 return _byteswap_ulong(x); 59 return _byteswap_ulong(x);
@@ -62,7 +70,7 @@ eina_swap32(unsigned int x)
62static inline unsigned long long 70static inline unsigned long long
63eina_swap64(unsigned long long x) 71eina_swap64(unsigned long long x)
64{ 72{
65#ifdef EINA_HAVE_BSWAP64 73#if EINA_HAS_BUILTIN(__builtin_bswap64)
66 return __builtin_bswap64(x); 74 return __builtin_bswap64(x);
67#elif defined _MSC_VER /* Windows. Apparently in <stdlib.h>. */ 75#elif defined _MSC_VER /* Windows. Apparently in <stdlib.h>. */
68 return _byteswap_uint64(x); 76 return _byteswap_uint64(x);