diff --git a/AK/Platform.h b/AK/Platform.h index d69ceba3af..b1534436d5 100644 --- a/AK/Platform.h +++ b/AK/Platform.h @@ -110,3 +110,16 @@ extern "C" { # define CLOCK_MONOTONIC_COARSE CLOCK_MONOTONIC # define CLOCK_REALTIME_COARSE CLOCK_REALTIME #endif + +#ifndef SYSTEM_CACHE_ALIGNMENT_SIZE +# if ARCH(AARCH64) || ARCH(x86_64) +# define SYSTEM_CACHE_ALIGNMENT_SIZE 64 +# else +# define SYSTEM_CACHE_ALIGNMENT_SIZE 128 +# endif +#endif /* SYSTEM_CACHE_ALIGNMENT_SIZE */ + +#ifdef CACHE_ALIGNED +# undef CACHE_ALIGNED +#endif +#define CACHE_ALIGNED alignas(SYSTEM_CACHE_ALIGNMENT_SIZE)