summary refs log tree commit diff homepage
path: root/torus.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2017-07-30 14:08:56 -0400
committerJune McEnroe <june@causal.agency>2017-07-30 14:08:56 -0400
commit71bab09c60e0d6c1043bebf97a83c41517562dde (patch)
tree57f4e0237251054282fc4a77483f660dced8dfb9 /torus.h
parentAdd chroot.sh (diff)
downloadtorus-71bab09c60e0d6c1043bebf97a83c41517562dde.tar.gz
torus-71bab09c60e0d6c1043bebf97a83c41517562dde.zip
Assert stable struct Tile field offsets
Diffstat (limited to '')
-rw-r--r--torus.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/torus.h b/torus.h
index 23b4708..bb012f2 100644
--- a/torus.h
+++ b/torus.h
@@ -1,6 +1,7 @@
+#include <assert.h>
 #include <stdbool.h>
+#include <stddef.h>
 #include <stdint.h>
-#include <assert.h>
 
 #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)