build: fixes for mingw support (#373)

This commit is contained in:
qruf 2023-09-16 20:15:31 +01:00 committed by GitHub
parent 0509c9a790
commit d189145a01
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 5 deletions

View File

@ -707,8 +707,8 @@ bool need_swap(std::ios_base &os)
void *q_aligned_malloc(size_t align, size_t size) void *q_aligned_malloc(size_t align, size_t size)
{ {
#ifdef _mm_malloc #ifdef _WIN32
return _mm_malloc(size, align); return _aligned_malloc(size, align);
#elif __STDC_VERSION__ >= 201112L #elif __STDC_VERSION__ >= 201112L
return aligned_alloc(align, size); return aligned_alloc(align, size);
#else #else
@ -722,8 +722,8 @@ void *q_aligned_malloc(size_t align, size_t size)
void q_aligned_free(void *ptr) void q_aligned_free(void *ptr)
{ {
#ifdef _mm_malloc #ifdef _WIN32
_mm_free(ptr); _aligned_free(ptr);
#else #else
free(ptr); free(ptr);
#endif #endif

View File

@ -6,7 +6,7 @@
#ifdef _WIN32 #ifdef _WIN32
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <Windows.h> #include <windows.h>
#endif #endif
static std::unique_ptr<tbb::global_control> tbbGlobalControl; static std::unique_ptr<tbb::global_control> tbbGlobalControl;

View File

@ -20,6 +20,7 @@
#pragma once #pragma once
#include <array> #include <array>
#include <cstdint>
#include <cstring> // for memcpy() #include <cstring> // for memcpy()
#include <string> #include <string>
#include <string_view> #include <string_view>

View File

@ -21,6 +21,7 @@
#include <cfloat> #include <cfloat>
#include <cmath> #include <cmath>
#include <cstdint>
#include <vector> #include <vector>
#include <algorithm> #include <algorithm>