more memsave through packed structure#

Thu, 08 Dec 2011 17:16:06 +0100

author
Malte Bayer <mbayer@neo-soft.org>
date
Thu, 08 Dec 2011 17:16:06 +0100
changeset 49
3957ff8e86c6
parent 48
5bba01aad0a6
child 50
84b8ab4cd79e

more memsave through packed structure#

blackbox/main.c file | annotate | diff | comparison | revisions
--- a/blackbox/main.c	Thu Dec 08 17:14:02 2011 +0100
+++ b/blackbox/main.c	Thu Dec 08 17:16:06 2011 +0100
@@ -27,12 +27,12 @@
 
 #define MAX_SLOTS       6
 typedef struct {
-    uint8_t speedlimit; // 4bits speedlimit
-    uint8_t speedminimum; // 4bits speedminimum
+    unsigned speedlimit:4; // 4bits speedlimit
+    unsigned speedminimum:4; // 4bits speedminimum
+    unsigned trackswitch:1; // 1bit bool
     uint8_t fuel;
     uint16_t jumpstart_time, laps;
     u32 lap_time_start, lap_time;
-    uint8_t trackswitch; // 1bit bool
 } cardata;
 
 static unsigned char s[8];

mercurial