Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Add MinGW port #185

Merged
merged 1 commit into from
May 4, 2021
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
20 changes: 10 additions & 10 deletions src/s2/base/port.h
Original file line number Diff line number Diff line change
Expand Up @@ -290,11 +290,11 @@ inline void sized_delete_array(void *ptr, size_t size) {

#endif

// defines __BYTE_ORDER for MSVC
#ifdef _MSC_VER
// defines __BYTE_ORDER
#ifdef _WIN32
#define __BYTE_ORDER __LITTLE_ENDIAN
#define IS_LITTLE_ENDIAN
#else
#else // _WIN32

// define the macros IS_LITTLE_ENDIAN or IS_BIG_ENDIAN
// using the above endian definitions from endian.h if
Expand All @@ -317,7 +317,7 @@ inline void sized_delete_array(void *ptr, size_t size) {
#endif

#endif // __BYTE_ORDER
#endif // _MSC_VER
#endif // _WIN32

// byte swap functions (bswap_16, bswap_32, bswap_64).

Expand Down Expand Up @@ -602,11 +602,11 @@ std::ostream &operator<<(std::ostream &out, const pthread_t &thread_id);
#endif // _MSC_VER

// random, srandom
#ifdef _MSC_VER
#ifdef _WIN32
// You say tomato, I say toma
inline int random() { return rand(); }
inline void srandom(unsigned int seed) { srand(seed); }
#endif // _MSC_VER
#endif // _WIN32

// bcopy, bzero
#ifdef _MSC_VER
Expand Down Expand Up @@ -884,9 +884,9 @@ inline void UnalignedCopy64(const void *src, void *dst) {
// __ASYLO__ platform uses newlib without an underlying OS, which provides
// memalign, but not posix_memalign.
#if defined(__cplusplus) && \
(((defined(__GNUC__) || defined(__APPLE__) || \
defined(__NVCC__)) && \
!defined(SWIG)) || \
(((defined(__GNUC__) || defined(__APPLE__) || \
defined(__NVCC__)) && \
!defined(SWIG) && !defined(__MINGW32__)) || \
((__GNUC__ >= 3 || defined(__clang__)) && defined(__ANDROID__)) || \
defined(__ASYLO__))
inline void *aligned_malloc(size_t size, size_t minimum_alignment) {
Expand All @@ -910,7 +910,7 @@ inline void aligned_free(void *aligned_memory) {
free(aligned_memory);
}

#elif defined(_MSC_VER) // MSVC
#elif defined(_WIN32)

inline void *aligned_malloc(size_t size, size_t minimum_alignment) {
return _aligned_malloc(size, minimum_alignment);
Expand Down