summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEven Rouault <even.rouault@spatialys.com>2017-06-20 18:24:21 +0200
committerEven Rouault <even.rouault@spatialys.com>2017-06-20 18:24:21 +0200
commitf06cfadef8e2b1ad9008957cc6bc80a27c53f2eb (patch)
tree41d0fc36d27ef8d9aaa70b3bec91092bbccf82bb /src
parentfa55b52d19f39765d7f108d654a8f87035a5772f (diff)
Enable __SSE__ / __SSE2__ with Visual Studio
Diffstat (limited to 'src')
-rw-r--r--src/lib/openjp2/opj_includes.h26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/lib/openjp2/opj_includes.h b/src/lib/openjp2/opj_includes.h
index 49aa3322..b33e63ce 100644
--- a/src/lib/openjp2/opj_includes.h
+++ b/src/lib/openjp2/opj_includes.h
@@ -187,6 +187,32 @@ static INLINE long opj_lrintf(float f)
# pragma intrinsic(__emul)
#endif
+/* Apparently Visual Studio doesn't define __SSE__ / __SSE2__ macros */
+#if defined(_M_X64)
+/* Intel 64bit support SSE and SSE2 */
+# ifndef __SSE__
+# define __SSE__ 1
+# endif
+# ifndef __SSE2__
+# define __SSE2__ 1
+# endif
+#endif
+
+/* For x86, test the value of the _M_IX86_FP macro. */
+/* See https://msdn.microsoft.com/en-us/library/b0084kay.aspx */
+#if defined(_M_IX86_FP)
+# if _M_IX86_FP >= 1
+# ifndef __SSE__
+# define __SSE__ 1
+# endif
+# endif
+# if _M_IX86_FP >= 2
+# ifndef __SSE2__
+# define __SSE2__ 1
+# endif
+# endif
+#endif
+
/* Type to use for bit-fields in internal headers */
typedef unsigned int OPJ_BITFIELD;