mirror of
https://git.sr.ht/~thestr4ng3r/chiaki
synced 2025-08-19 21:13:12 -07:00
Implement chiaki_aligned_alloc for macOS
This commit is contained in:
parent
2b8bf99dd5
commit
cb72d4cd4e
1 changed files with 8 additions and 0 deletions
|
@ -66,7 +66,15 @@ CHIAKI_EXPORT const char *chiaki_error_string(ChiakiErrorCode code)
|
||||||
|
|
||||||
void *chiaki_aligned_alloc(size_t alignment, size_t size)
|
void *chiaki_aligned_alloc(size_t alignment, size_t size)
|
||||||
{
|
{
|
||||||
|
#if __APPLE__
|
||||||
|
void *r;
|
||||||
|
if(posix_memalign(&r, alignment, size) == 0)
|
||||||
|
return r;
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
#else
|
||||||
return aligned_alloc(alignment, size);
|
return aligned_alloc(alignment, size);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
CHIAKI_EXPORT ChiakiErrorCode chiaki_lib_init()
|
CHIAKI_EXPORT ChiakiErrorCode chiaki_lib_init()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue