-betterC works on linux with DMD

This commit is contained in:
Mergul 2019-10-11 19:05:41 +02:00
parent 633aad6cb7
commit cde772c077
2 changed files with 24 additions and 3 deletions

View file

@ -131,9 +131,8 @@ static struct Mallocator
static void* alignAlloc(size_t length, size_t alignment) nothrow @nogc
{
void* ret;
version(Posix)ret = aligned_alloc(alignment, length);
version(Posix)posix_memalign(&ret, alignment, length);//ret = aligned_alloc(alignment, length);
else version(Windows)ret = _aligned_malloc(length, alignment);
else static assert(0, "Unimplemented platform!");
//posix_memalign(&ret, alignment, length);
@ -149,7 +148,7 @@ static struct Mallocator
static void alignDispose(T)(T object)
{
static if(__traits(hasMember, T, "__dtor"))object.__dtor();
version(Posix)aligned_free(cast(void*)object);
version(Posix)free(cast(void*)object);
else version(Windows)_aligned_free(cast(void*)object);
else static assert(0, "Unimplemented platform!");