diff options
author | Charlie Stanton <charlie@shtanton.xyz> | 2025-04-05 13:36:00 +0100 |
---|---|---|
committer | Charlie Stanton <charlie@shtanton.xyz> | 2025-04-05 13:36:00 +0100 |
commit | dbb9359324c4224e0cd6034f06d7cbf4c4fd020b (patch) | |
tree | 6df541ac5713210a7a979c2751dffc3ddc260f17 | |
parent | c2f5cb0a8ebf1867d808ed126eb29f5214e4ee4d (diff) | |
download | ldjam57-dbb9359324c4224e0cd6034f06d7cbf4c4fd020b.tar |
janky memcpy fix
-rw-r--r-- | src/all.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -1,6 +1,14 @@ #include <stddef.h> #include <stdint.h> +#if SDL +#include <string.h> +#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++) { |