Back to shtanton's homepage
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorCharlie Stanton <charlie@shtanton.xyz>2025-04-05 13:36:00 +0100
committerCharlie Stanton <charlie@shtanton.xyz>2025-04-05 13:36:00 +0100
commitdbb9359324c4224e0cd6034f06d7cbf4c4fd020b (patch)
tree6df541ac5713210a7a979c2751dffc3ddc260f17 /src
parentc2f5cb0a8ebf1867d808ed126eb29f5214e4ee4d (diff)
downloadldjam57-dbb9359324c4224e0cd6034f06d7cbf4c4fd020b.tar
janky memcpy fix
Diffstat (limited to 'src')
-rw-r--r--src/all.c10
1 files changed, 9 insertions, 1 deletions
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 <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++) {