[x264-devel] [PATCH] osdep: make aware of MSVC

Steve Borho steve at borho.org
Tue May 20 20:29:47 CEST 2014


# HG changeset patch
# User Steve Borho <steve at borho.org>
# Date 1400609639 18000
#      Tue May 20 13:13:59 2014 -0500
# Node ID 0dc8611d2feec2d44ffba2a79472694a61fb0e66
# Parent  b07a2ecf2c00fe76b497c3909bce5efb79ec4635
osdep: make aware of MSVC

diff -r b07a2ecf2c00 -r 0dc8611d2fee common/osdep.h
--- a/common/osdep.h	Wed Apr 09 03:33:06 2014 -0300
+++ b/common/osdep.h	Tue May 20 13:13:59 2014 -0500
@@ -48,7 +48,7 @@
 #define log2(x) (log(x)/0.693147180559945)
 #endif
 
-#ifdef __ICL
+#if defined(__ICL) || defined(_MSC_VER)
 #define inline __inline
 #define strcasecmp _stricmp
 #define strncasecmp _strnicmp
@@ -89,7 +89,7 @@
 #define x264_is_pipe(x)  0
 #endif
 
-#ifdef __ICL
+#if defined(__ICL) || defined(_MSC_VER)
 #define DECLARE_ALIGNED( var, n ) __declspec(align(n)) var
 #else
 #define DECLARE_ALIGNED( var, n ) var __attribute__((aligned(n)))
@@ -146,27 +146,33 @@
 #define ALIGNED_ARRAY_N ALIGNED_ARRAY_16
 #endif
 
+#ifdef _MSC_VER
+#define UNINIT(x) x
+#else
 #define UNINIT(x) x=x
+#endif
 
 #if defined(__GNUC__) && (__GNUC__ > 3 || __GNUC__ == 3 && __GNUC_MINOR__ > 0)
-#define UNUSED __attribute__((unused))
-#define ALWAYS_INLINE __attribute__((always_inline)) inline
-#define NOINLINE __attribute__((noinline))
-#define MAY_ALIAS __attribute__((may_alias))
-#define x264_constant_p(x) __builtin_constant_p(x)
-#define x264_nonconstant_p(x) (!__builtin_constant_p(x))
+# define UNUSED __attribute__((unused))
+# define ALWAYS_INLINE __attribute__((always_inline)) inline
+# define NOINLINE __attribute__((noinline))
+# define MAY_ALIAS __attribute__((may_alias))
+# define x264_constant_p(x) __builtin_constant_p(x)
+# define x264_nonconstant_p(x) (!__builtin_constant_p(x))
+#elif defined(__ICL) || defined(_MSC_VER)
+# define ALWAYS_INLINE __forceinline
+# define NOINLINE __declspec(noinline)
+# define UNUSED
+# define MAY_ALIAS
+# define x264_constant_p(x) 0
+# define x264_nonconstant_p(x) 0
 #else
-#ifdef __ICL
-#define ALWAYS_INLINE __forceinline
-#define NOINLINE __declspec(noinline)
-#else
-#define ALWAYS_INLINE inline
-#define NOINLINE
-#endif
-#define UNUSED
-#define MAY_ALIAS
-#define x264_constant_p(x) 0
-#define x264_nonconstant_p(x) 0
+# define ALWAYS_INLINE inline
+# define NOINLINE
+# define UNUSED
+# define MAY_ALIAS
+# define x264_constant_p(x) 0
+# define x264_nonconstant_p(x) 0
 #endif
 
 /* threads */


More information about the x264-devel mailing list