fix mingw

This commit is contained in:
SchrodingerZhu
2020-03-08 22:13:49 +08:00
parent 51e919385f
commit 65de3c41bc
4 changed files with 16 additions and 3 deletions

View File

@@ -72,6 +72,8 @@ if(NOT MSVC)
target_compile_options(snmalloc_lib INTERFACE -mcx16)
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64")
target_compile_options(snmalloc_lib INTERFACE -mcx16)
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
target_compile_options(snmalloc_lib INTERFACE -mcx16)
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
target_compile_options(snmalloc_lib INTERFACE -mcx16)
# XXX elseif ARM?

View File

@@ -13,7 +13,9 @@
#include <cassert>
#include <cstdint>
#include <type_traits>
#if defined(_WIN32) && defined(__GNUC__)
#define USE_CLZLL
#endif
#ifdef pause
# undef pause
#endif
@@ -75,6 +77,8 @@ namespace snmalloc
return BITS - index - 1;
# endif
#elif defined(USE_CLZLL)
return static_cast<size_t>(__builtin_clzll(x));
#else
return static_cast<size_t>(__builtin_clzl(x));
#endif

View File

@@ -5,8 +5,13 @@
#include "../mem/allocconfig.h"
#ifdef _WIN32
# ifndef _MSC_VER
# include <cstdio>
# endif
# define WIN32_LEAN_AND_MEAN
# define NOMINMAX
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <windows.h>
// VirtualAlloc2 is exposed in RS5 headers.
# ifdef NTDDI_WIN10_RS5

View File

@@ -2,7 +2,9 @@
#if defined(_WIN32)
# define WIN32_LEAN_AND_MEAN
# define NOMINMAX
# ifndef NOMINMAX
# define NOMINMAX
# endif
# include <windows.h>
// Needs to be included after windows.h
# include <psapi.h>