-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Arena Allocator updates * Cleanup * Apply clang-format * Teensy fix * Fixing allocation issues * ifdef __clang__ --------- Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
8843e52
commit 46fe42c
Showing
7 changed files
with
146 additions
and
45 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
#pragma once | ||
|
||
#include <cstdlib> | ||
|
||
namespace chowdsp | ||
{ | ||
#if JUCE_TEENSY | ||
|
||
/** MSVC-compatible implementation of aligned_alloc */ | ||
[[nodiscard]] inline void* aligned_alloc ([[maybe_unused]] size_t alignment, size_t size) | ||
{ | ||
// @TODO | ||
return malloc (size + alignment); | ||
} | ||
|
||
/** MSVC-compatible implementation of aligned_free */ | ||
inline void aligned_free (void* data) | ||
{ | ||
free (data); | ||
} | ||
|
||
#elif defined(_MSC_VER) | ||
|
||
/** MSVC-compatible implementation of aligned_alloc */ | ||
[[nodiscard]] inline void* aligned_alloc (size_t alignment, size_t size) | ||
{ | ||
return _aligned_malloc (size, alignment); | ||
} | ||
|
||
/** MSVC-compatible implementation of aligned_free */ | ||
inline void aligned_free (void* data) | ||
{ | ||
_aligned_free (data); | ||
} | ||
|
||
#else | ||
|
||
/** MSVC-compatible implementation of aligned_alloc */ | ||
[[nodiscard]] inline void* aligned_alloc (size_t alignment, size_t size) | ||
{ | ||
#ifdef __clang__ | ||
#pragma clang diagnostic push | ||
#pragma clang diagnostic ignored "-Wunguarded-availability-new" | ||
#endif | ||
|
||
return std::aligned_alloc (alignment, size); | ||
|
||
#ifdef __clang__ | ||
#pragma clang diagnostic pop | ||
#endif | ||
} | ||
|
||
/** MSVC-compatible implementation of aligned_free */ | ||
inline void aligned_free (void* data) | ||
{ | ||
std::free (data); | ||
} | ||
|
||
#endif | ||
} // namespace chowdsp |
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
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