From 3eff6ff36fa68ecbf97bb23fcf5e95ccf864e2d8 Mon Sep 17 00:00:00 2001 From: Wolfgang Thaller Date: Sat, 7 Oct 2017 16:10:05 +0200 Subject: [PATCH] libretro/malloc.c: "implement" memalign. Just hope that NewPtr aligns enough anyway (16 byte on PowerPC) --- libretro/malloc.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/libretro/malloc.c b/libretro/malloc.c index ce8d4e5b89..1bb5df415b 100644 --- a/libretro/malloc.c +++ b/libretro/malloc.c @@ -115,3 +115,22 @@ void *calloc(size_t sz1, size_t sz2) { return _calloc_r(_REENT, sz1, sz2); } + +void *memalign(size_t alignment, size_t sz) +{ + Ptr p = NewPtr(sz); + + if(!p) + errno = ENOMEM; + + // FIXME: + // NewPtr aligns to 4 bytes on 68020 and 68030, + // and to 16 bytes on 68040 and PowerPC. + + // Do something else when more alignment is required. + // This might be hard, as adding extra overhead to all normal allocations + // just so that we can distinguish things in free() doesn't sound like it's worth it. + + return p; +} +