From: Sebastian Date: Wed, 30 Jul 2014 18:46:05 +0000 (+0000) Subject: shared: don't pack shm_t, but align it instead X-Git-Url: http://sraa.de/git/%3CTMPL_VAR%20NAME=URL%3E?a=commitdiff_plain;h=3b6424ef50be6a7d89d6cd02b48bf10469cb0bad;p=lattice-boltzmann-epiphany.git 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. --- 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_ */