From 87d25c089663615e2b7608117be01fad432b15b0 Mon Sep 17 00:00:00 2001 From: James Larrowe Date: Mon, 22 Jun 2020 20:14:32 +0000 Subject: [PATCH] Compatibility hacks for old compilers GCC versions below 4.8.1 didn't have __builtin_bswap16, so provide a suitable replacement. --- Core/gb.h | 4 ++++ Makefile | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Core/gb.h b/Core/gb.h index b773ebbb..409e4cd1 100644 --- a/Core/gb.h +++ b/Core/gb.h @@ -52,6 +52,10 @@ #error Unable to detect endianess #endif +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 8) +#define __builtin_bswap16(x) ({ typeof(x) _x = (x); _x >> 8 | _x << 8; }) +#endif + typedef struct { struct { uint8_t r, g, b; diff --git a/Makefile b/Makefile index d598f974..f8e99350 100644 --- a/Makefile +++ b/Makefile @@ -392,7 +392,7 @@ $(OBJ)/BootROMs/SameBoyLogo.pb12: $(OBJ)/BootROMs/SameBoyLogo.2bpp $(PB12_COMPRE $(realpath $(PB12_COMPRESS)) < $< > $@ $(PB12_COMPRESS): BootROMs/pb12.c - $(NATIVE_CC) -Wall -Werror $< -o $@ + $(NATIVE_CC) -std=c99 -Wall -Werror $< -o $@ $(BIN)/BootROMs/agb_boot.bin: BootROMs/cgb_boot.asm $(BIN)/BootROMs/cgb_boot_fast.bin: BootROMs/cgb_boot.asm