shared: don't pack shm_t, but align it instead
authorSebastian <git@sraa.de>
Wed, 30 Jul 2014 18:46:05 +0000 (18:46 +0000)
committerSebastian <git@sraa.de>
Wed, 30 Jul 2014 18:46:05 +0000 (18:46 +0000)
Accesses to the poll flag or the iteration counter do not
result in four byte-accesses anymore. Sigh.

lb/shared.h

index 512ee958fb6a080269637e5ee6f76e9c5e77907b..607a3e183b86f4f2e34a0cd4d52077b309d1f190 100644 (file)
@@ -7,9 +7,10 @@
 /* preprocessor magic */
 #define BUILD_BUG(c) do { ((void)sizeof(char[1 - 2*!!(c)])); } while(0);
 #define UNUSED __attribute__((unused))
-#ifndef PACKED
-#      define PACKED __attribute__((packed))
-#endif /* PACKED */
+#undef PACKED
+#define PACKED __attribute__((packed))
+#undef ALIGN
+#define ALIGN(X) __attribute__((aligned(X)))
 
 /* number of cores */
 #define CORES_X 4
@@ -40,7 +41,7 @@ typedef struct {
        uint32_t     iteration;
        uint32_t     timers[CORES_Y][CORES_X][TIMERS];
        d2q9_block_t lattice[CORES_Y][CORES_X];
-} PACKED shm_t;
+} ALIGN(8) shm_t;
 
 #endif /* _SHARED_H_ */