From 71bab09c60e0d6c1043bebf97a83c41517562dde Mon Sep 17 00:00:00 2001 From: June McEnroe Date: Sun, 30 Jul 2017 14:08:56 -0400 Subject: Assert stable struct Tile field offsets --- torus.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'torus.h') diff --git a/torus.h b/torus.h index 23b4708..bb012f2 100644 --- a/torus.h +++ b/torus.h @@ -1,6 +1,7 @@ +#include #include +#include #include -#include #define ALIGNED(x) __attribute__((aligned(x))) @@ -29,6 +30,8 @@ struct Tile { uint8_t colors[CELL_ROWS][CELL_COLS] ALIGNED(16); } ALIGNED(4096); static_assert(sizeof(struct Tile) == 4096, "struct Tile is page-sized"); +static_assert(offsetof(struct Tile, cells) == 16, "stable cells offset"); +static_assert(offsetof(struct Tile, colors) == 2016, "stable colors offset"); #define TILE_ROWS (512) #define TILE_COLS (512) -- cgit 1.4.1