From 3b6424ef50be6a7d89d6cd02b48bf10469cb0bad Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 30 Jul 2014 18:46:05 +0000 Subject: [PATCH] shared: don't pack shm_t, but align it instead Accesses to the poll flag or the iteration counter do not result in four byte-accesses anymore. Sigh. --- lb/shared.h | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lb/shared.h b/lb/shared.h index 512ee95..607a3e1 100644 --- a/lb/shared.h +++ b/lb/shared.h @@ -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_ */ -- 2.30.2