about summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorJune McEnroe <programble@gmail.com>2018-03-05 12:45:17 -0500
committerJune McEnroe <programble@gmail.com>2018-03-05 12:45:17 -0500
commitf883e5bf73cc11f545ef5a72cbebf8f2aeea69da (patch)
tree014ae5454831fdc82ddb232bea6f00ee697b9c28
parentUndef COLOR_ constants in torus.h (diff)
downloadtorus-f883e5bf73cc11f545ef5a72cbebf8f2aeea69da.tar.gz
torus-f883e5bf73cc11f545ef5a72cbebf8f2aeea69da.zip
Pack message type enums
Diffstat (limited to '')
-rw-r--r--torus.h27
1 files changed, 12 insertions, 15 deletions
diff --git a/torus.h b/torus.h
index fd158ed..6d819a3 100644
--- a/torus.h
+++ b/torus.h
@@ -20,6 +20,7 @@
 #include <stdint.h>
 #include <time.h>
 
+#define PACKED __attribute__((packed))
 #define ALIGNED(x) __attribute__((aligned(x)))
 
 #undef COLOR_BLACK
@@ -80,15 +81,13 @@ static const struct {
 
 #define SPAWN_COUNT (sizeof(SPAWN) / sizeof(SPAWN[0]))
 
-enum ServerMessageType {
-    SERVER_TILE,
-    SERVER_MOVE,
-    SERVER_PUT,
-    SERVER_CURSOR,
-};
-
 struct ServerMessage {
-    enum ServerMessageType type;
+    enum PACKED {
+        SERVER_TILE,
+        SERVER_MOVE,
+        SERVER_PUT,
+        SERVER_CURSOR,
+    } type;
     union {
         struct {
             uint8_t cellX;
@@ -111,14 +110,12 @@ struct ServerMessage {
 
 #define CURSOR_NONE UINT8_MAX
 
-enum ClientMessageType {
-    CLIENT_MOVE,
-    CLIENT_PUT,
-    CLIENT_SPAWN,
-};
-
 struct ClientMessage {
-    enum ClientMessageType type;
+    enum PACKED {
+        CLIENT_MOVE,
+        CLIENT_PUT,
+        CLIENT_SPAWN,
+    } type;
     union {
         struct {
             int8_t dx;
2019-12-21 03:34:56 -0500'>2019-12-21Add first working version of imboxJune McEnroe 2019-12-20Respect mailmap in gl pretty formatJune McEnroe 2019-12-20Set LANG in cgit filtersJune McEnroe 2019-12-20Source .editrc before applying -v or -eJune McEnroe 2019-12-20Disable signing commitsJune McEnroe 2019-12-19Ignore about-filterJune McEnroe 2019-12-19Fix matching make tags with no sourcesJune McEnroe 2019-12-19Avoid matching := assignments as tagsJune McEnroe 2019-12-18Hide line numbers when rendering mdocJune McEnroe 2019-12-18Customize cgit CSSJune McEnroe 2019-12-18Use :target rather than :focus pseudo-classJune McEnroe 2019-12-18Copy cgit auxiliary binaries properlyJune McEnroe 2019-12-18Add git.causal.agency cgit configJune McEnroe 2019-12-18Bail from hi if input is binaryJune McEnroe 2019-12-16Post "cgit setup"June McEnroe