Avoid malloc poisoning issue when including <pthread.h> of uclibc (#1013)
[openjpeg.git] / src / lib / openjp2 / opj_includes.h
index 98ade3fd04e19b478988c99d3b0e8640b75e2e59..0a8628c96b3043f2d1635f32dca2be7b08340881 100644 (file)
@@ -187,9 +187,37 @@ 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;
 
+#define OPJ_UNUSED(x) (void)x
+
 #include "opj_inttypes.h"
 #include "opj_clock.h"
 #include "opj_malloc.h"
@@ -207,7 +235,6 @@ typedef unsigned int OPJ_BITFIELD;
 #include "jp2.h"
 
 #include "mqc.h"
-#include "raw.h"
 #include "bio.h"
 
 #include "pi.h"
@@ -218,6 +245,7 @@ typedef unsigned int OPJ_BITFIELD;
 #include "t2.h"
 #include "mct.h"
 #include "opj_intmath.h"
+#include "sparse_array.h"
 
 #ifdef USE_JPIP
 #include "cidx_manager.h"