From dbb9359324c4224e0cd6034f06d7cbf4c4fd020b Mon Sep 17 00:00:00 2001 From: Charlie Stanton Date: Sat, 5 Apr 2025 13:36:00 +0100 Subject: janky memcpy fix --- src/all.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/all.c b/src/all.c index 43b5d13..37a57c9 100644 --- a/src/all.c +++ b/src/all.c @@ -1,6 +1,14 @@ #include #include +#if SDL +#include +#define xmemcpy memcpy +#else +#define xmemcpy __builtin_memcpy +#endif + + typedef struct { unsigned char r, g, b, a; } Color; @@ -122,7 +130,7 @@ static void update(Game *game, uint64_t now, Arena a) { if (game->state.playing && game->state.lastTick + TICK_LENGTH <= now) { game->state.lastTick = now; State *lastState = new(&a, 1, State); - __builtin_memcpy(lastState, game, sizeof(State)); + xmemcpy(lastState, game, sizeof(State)); for (int x = 0; x < GRIDWIDTH; x++) { for (int y = 0; y < GRIDHEIGHT; y++) { -- cgit v1.2.3