summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYann Collet <Cyan4973@users.noreply.github.com>2017-08-11 17:49:25 (GMT)
committerGitHub <noreply@github.com>2017-08-11 17:49:25 (GMT)
commit228e26ee63818c22ea9c4aff0eb47d82306d44e5 (patch)
tree09a966698b395f939eb01be77678e6a226791178
parente98a528576c1cc095dcdcf9ff1f4e3e8422a535d (diff)
parent76ef6d0ab0ea0937e8bb92c3a11a6445504d720f (diff)
downloadlz4-228e26ee63818c22ea9c4aff0eb47d82306d44e5.zip
lz4-228e26ee63818c22ea9c4aff0eb47d82306d44e5.tar.gz
lz4-228e26ee63818c22ea9c4aff0eb47d82306d44e5.tar.bz2
Merge pull request #378 from deymo/dev
Allow to predefine FORCE_INLINE macro.
-rw-r--r--lib/lz4.c25
-rw-r--r--lib/xxhash.c27
2 files changed, 32 insertions, 20 deletions
diff --git a/lib/lz4.c b/lib/lz4.c
index 87ec6ab..62e4dc2 100644
--- a/lib/lz4.c
+++ b/lib/lz4.c
@@ -96,20 +96,27 @@
* Compiler Options
**************************************/
#ifdef _MSC_VER /* Visual Studio */
-# define FORCE_INLINE static __forceinline
# include <intrin.h>
# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
# pragma warning(disable : 4293) /* disable: C4293: too large shift (32-bits) */
-#else
-# if defined(__GNUC__) || defined(__clang__)
-# define FORCE_INLINE static inline __attribute__((always_inline))
-# elif defined(__cplusplus) || (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L) /* C99 */)
-# define FORCE_INLINE static inline
-# else
-# define FORCE_INLINE static
-# endif
#endif /* _MSC_VER */
+#ifndef FORCE_INLINE
+# ifdef _MSC_VER /* Visual Studio */
+# define FORCE_INLINE static __forceinline
+# else
+# if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
+# ifdef __GNUC__
+# define FORCE_INLINE static inline __attribute__((always_inline))
+# else
+# define FORCE_INLINE static inline
+# endif
+# else
+# define FORCE_INLINE static
+# endif /* __STDC_VERSION__ */
+# endif /* _MSC_VER */
+#endif /* FORCE_INLINE */
+
#if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__)
# define expect(expr,value) (__builtin_expect ((expr),(value)) )
#else
diff --git a/lib/xxhash.c b/lib/xxhash.c
index e9ff2d4..a532358 100644
--- a/lib/xxhash.c
+++ b/lib/xxhash.c
@@ -113,19 +113,24 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) { return memcp
***************************************/
#ifdef _MSC_VER /* Visual Studio */
# pragma warning(disable : 4127) /* disable: C4127: conditional expression is constant */
-# define FORCE_INLINE static __forceinline
-#else
-# if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
-# ifdef __GNUC__
-# define FORCE_INLINE static inline __attribute__((always_inline))
-# else
-# define FORCE_INLINE static inline
-# endif
-# else
-# define FORCE_INLINE static
-# endif /* __STDC_VERSION__ */
#endif
+#ifndef FORCE_INLINE
+# ifdef _MSC_VER /* Visual Studio */
+# define FORCE_INLINE static __forceinline
+# else
+# if defined (__cplusplus) || defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L /* C99 */
+# ifdef __GNUC__
+# define FORCE_INLINE static inline __attribute__((always_inline))
+# else
+# define FORCE_INLINE static inline
+# endif
+# else
+# define FORCE_INLINE static
+# endif /* __STDC_VERSION__ */
+# endif /* _MSC_VER */
+#endif /* FORCE_INLINE */
+
/* *************************************
* Basic Types