Skip to content

fix MinGW #137

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Merged
merged 2 commits into from
Mar 9, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this not be a case-insensitive string compare (e.g. use TOLOWER on the processor and then compare against amd64)?

target_compile_options(snmalloc_lib INTERFACE -mcx16)
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86")
target_compile_options(snmalloc_lib INTERFACE -mcx16)
# XXX elseif ARM?
7 changes: 5 additions & 2 deletions src/ds/bits.h
Original file line number Diff line number Diff line change
@@ -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
7 changes: 6 additions & 1 deletion src/pal/pal_windows.h
Original file line number Diff line number Diff line change
@@ -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
4 changes: 3 additions & 1 deletion src/test/usage.h
Original file line number Diff line number Diff line change
@@ -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>