Merge pull request #137 from SchrodingerZhu/master

fix MinGW
This commit is contained in:
Matthew Parkinson
2020-03-09 11:57:18 +00:00
committed by GitHub
4 changed files with 16 additions and 4 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

@@ -1,7 +1,6 @@
#pragma once
#include <limits>
#include <stddef.h>
// #define USE_LZCNT
@@ -13,7 +12,9 @@
#include <cassert>
#include <cstdint>
#include <type_traits>
#if defined(_WIN32) && defined(__GNUC__)
# define USE_CLZLL
#endif
#ifdef pause
# undef pause
#endif
@@ -75,6 +76,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>