diff options
author | Jonathan Wright <jonathan.wright@arm.com> | 2020-08-25 12:26:52 +0100 |
---|---|---|
committer | Jonathan Wright <jonathan.wright@arm.com> | 2020-08-25 12:33:13 +0100 |
commit | a2a9d5e790805e88e560e7c84732b4e393597c36 (patch) | |
tree | 314ee8df4004c63a577f2639b7f74aca1bd7e4c5 /jconfigint.h | |
parent | 09caedd340984b44a4c97337d172039b40920a01 (diff) |
Add compiler-independent alignment macro
Some variables and structures need memory alignment and the syntax
for declaring it differs when using MSVC compared to GCC and Clang.
This commit adds a compiler-independent alignment macro and uses it
to apply 16-byte alignment for constant pools and temporary buffers
used in Arm NEON SIMD code.
Bug: 922430
Change-Id: Ic2beb7bae88504ba7f3e86e33ef31bf388774403
Diffstat (limited to 'jconfigint.h')
-rw-r--r-- | jconfigint.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/jconfigint.h b/jconfigint.h index 10bcac7..974890d 100644 --- a/jconfigint.h +++ b/jconfigint.h @@ -52,3 +52,12 @@ #define HAVEBITSCANFORWARD #endif #endif + +/* How to obtain memory alignment for structures and variables. */ +#if defined(_MSC_VER) +#define ALIGN(ALIGNMENT) __declspec(align((ALIGNMENT))) +#elif defined(__clang__) || defined(__GNUC__) +#define ALIGN(ALIGNMENT) __attribute__((aligned(ALIGNMENT))) +#else +#error "Unknown compiler" +#endif |