-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #990 from jpcima/macos
Set the macOS compability back to 10.9
- Loading branch information
Showing
4 changed files
with
108 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
// SPDX-License-Identifier: BSD-2-Clause | ||
|
||
// This code is part of the sfizz library and is licensed under a BSD 2-clause | ||
// license. You should have receive a LICENSE.md file along with the code. | ||
// If not, contact the sfizz maintainers at https://github.com/sfztools/sfizz | ||
|
||
#if defined(SFIZZ_IMPLEMENT_CXX17_ALIGNED_NEW_SUPPORT) | ||
#include <new> | ||
#if defined(_WIN32) | ||
# include <malloc.h> | ||
#else | ||
# include <stdlib.h> | ||
#endif | ||
|
||
void* operator new(std::size_t count, std::align_val_t al, const std::nothrow_t&) noexcept | ||
{ | ||
void *ptr; | ||
#if defined(_WIN32) | ||
ptr = ::_aligned_malloc(count, static_cast<std::size_t>(al)); | ||
#else | ||
if (::posix_memalign(&ptr, static_cast<std::size_t>(al), count) != 0) | ||
ptr = nullptr; | ||
#endif | ||
return ptr; | ||
} | ||
|
||
void operator delete(void* ptr, std::align_val_t, const std::nothrow_t&) noexcept | ||
{ | ||
#if defined(_WIN32) | ||
::_aligned_free(ptr); | ||
#else | ||
::free(ptr); | ||
#endif | ||
} | ||
|
||
//------------------------------------------------------------------------------ | ||
|
||
void* operator new(std::size_t count, std::align_val_t al) | ||
{ | ||
void *ptr = operator new(count, al, std::nothrow); | ||
if (!ptr) | ||
throw std::bad_alloc(); | ||
return ptr; | ||
} | ||
|
||
void operator delete(void* ptr, std::align_val_t al) noexcept | ||
{ | ||
operator delete(ptr, al, std::nothrow); | ||
} | ||
|
||
//------------------------------------------------------------------------------ | ||
|
||
void* operator new[](std::size_t count, std::align_val_t al) | ||
{ | ||
return operator new(count, al); | ||
} | ||
|
||
void* operator new[](std::size_t count, std::align_val_t al, const std::nothrow_t& tag) noexcept | ||
{ | ||
return operator new(count, al, tag); | ||
} | ||
|
||
void operator delete[](void* ptr, std::align_val_t al) noexcept | ||
{ | ||
operator delete(ptr, al); | ||
} | ||
|
||
void operator delete[](void* ptr, std::align_val_t al, const std::nothrow_t& tag) noexcept | ||
{ | ||
operator delete(ptr, al, tag); | ||
} | ||
|
||
|
||
#endif // defined(SFIZZ_IMPLEMENT_CXX17_ALIGNED_NEW_SUPPORT) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters