From 1bd136fc0065ca6b1b5dfc8aac1fabe356f626a6 Mon Sep 17 00:00:00 2001 From: Wolfywolfy Date: Wed, 27 Nov 2024 09:07:42 -0300 Subject: [PATCH] =?UTF-8?q?Add=20aligned=5Falloc=20instead=20of=20memalign?= =?UTF-8?q?.=20aligned=5Falloc=20is=20a=20c11=20function=20that=20checks?= =?UTF-8?q?=20the=20allignment=20of=20the=20power=20of=20two=20which=20mem?= =?UTF-8?q?align=20doesn=C2=B4t.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 2 +- src/atlas.c | 2 +- src/opl.c | 2 +- src/util.c | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 4f76af054..217790492 100644 --- a/Makefile +++ b/Makefile @@ -214,7 +214,7 @@ endif EE_CFLAGS += -fsingle-precision-constant -DOPL_VERSION=\"$(OPL_VERSION)\" # There are a few places where the config key/value are truncated, so disable these warnings -EE_CFLAGS += -Wno-format-truncation -Wno-stringop-truncation +EE_CFLAGS += -Wno-format-truncation -Wno-stringop-truncation -std=gnu11 # Generate .d files to track header file dependencies of each object file EE_CFLAGS += -MMD -MP EE_OBJS += $(FRONTEND_OBJS) $(GFX_OBJS) $(AUDIO_OBJS) $(MISC_OBJS) $(EECORE_OBJS) $(IOP_OBJS) diff --git a/src/atlas.c b/src/atlas.c index e68136059..ef7e52d33 100644 --- a/src/atlas.c +++ b/src/atlas.c @@ -95,7 +95,7 @@ atlas_t *atlasNew(size_t width, size_t height, u8 psm) size_t txtsize = gsKit_texture_size(width, height, psm); atlas->surface.PSM = psm; - atlas->surface.Mem = (u32 *)memalign(128, txtsize); + atlas->surface.Mem = (u32 *)aligned_alloc(128, txtsize); atlas->surface.Vram = 0; // defaults to no clut diff --git a/src/opl.c b/src/opl.c index cd6098353..272164ae1 100644 --- a/src/opl.c +++ b/src/opl.c @@ -1275,7 +1275,7 @@ static void compatUpdate(item_list_t *support, unsigned char mode, config_set_t result = 0; LOG("CompatUpdate: updating for: device %d game %d\n", device, configSet == NULL ? -1 : id); - if ((HttpBuffer = memalign(64, HTTP_IOBUF_SIZE)) != NULL) { + if ((HttpBuffer = aligned_alloc(64, HTTP_IOBUF_SIZE)) != NULL) { count = configSet != NULL ? 1 : support->itemGetCount(support); if (count > 0) { diff --git a/src/util.c b/src/util.c index 1a2d51edf..564874a00 100644 --- a/src/util.c +++ b/src/util.c @@ -194,7 +194,7 @@ void *readFile(char *path, int align, int *size) } if (align > 0) - buffer = memalign(64, realSize); // The allocation is aligned to aid the DMA transfers + buffer = aligned_alloc(64, realSize); // The allocation is aligned to aid the DMA transfers else buffer = malloc(realSize);