From 515992ffca07b2aeb6c13b333b194e42e5a1fe34 Mon Sep 17 00:00:00 2001 From: Curtis McEnroe Date: Thu, 19 Jul 2018 15:44:16 -0400 Subject: Add ARRAY_LEN macro --- torus.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'torus.h') diff --git a/torus.h b/torus.h index 918a131..775df3c 100644 --- a/torus.h +++ b/torus.h @@ -24,6 +24,8 @@ #define PACKED __attribute__((packed)) #define ALIGNED(x) __attribute__((aligned(x))) +#define ARRAY_LEN(a) (sizeof(a) / sizeof((a)[0])) + #undef COLOR_BLACK #undef COLOR_RED #undef COLOR_GREEN @@ -86,7 +88,6 @@ static const struct { { TILE_COLS * 1 / 4, TILE_ROWS * 1 / 4 }, // SE { TILE_COLS * 3 / 4, TILE_ROWS * 1 / 4 }, // SW }; -static const size_t SPAWNS_LEN = sizeof(SPAWNS) / sizeof(SPAWNS[0]); enum { MAP_ROWS = 11, -- cgit 1.4.1