Add support for compiling under MinGW + fix Windows compiling in general

This commit is contained in:
wuggy 2026-04-17 15:05:11 -07:00
commit a5cf494890
56 changed files with 243 additions and 76 deletions

View file

@ -36,6 +36,12 @@ typedef __m128i z_vec128i_t;
#error chunkcopy.h inflate chunk SIMD is not defined for your build target
#endif
#if defined(_MSC_VER)
#define Z_ALIGN16(type, name) __declspec(align(16)) type name
#else
#define Z_ALIGN16(type, name) type name __attribute__((aligned(16)))
#endif
#ifdef _MSC_VER
#if _MSC_VER < 1900
#define inline
@ -222,7 +228,7 @@ static inline z_vec128i_t v_load64_dup(const void* src) {
#if 0//def _WIN64
return _mm_set1_epi64x(i64);
#else
_declspec(align(16)) uint64_t temp[2] = {i64, i64};
Z_ALIGN16(uint64_t, temp[2]) = {i64, i64};
return _mm_load_si128((const __m128i*)temp);
#endif
}

View file

@ -88,4 +88,8 @@ else:
'inflate.c',
]
if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['GNU_CC']:
SOURCES['crc32_simd.c'].flags += ['-msse4.2', '-mpclmul']
SOURCES['crc_folding.c'].flags += ['-msse4.2', '-mpclmul']