7 ms·
I think this is _Alignas/alignas. struct foo { _Alignas(64) float x,y; _Alignas(64) int z; }; _Static_assert(sizeof(struct foo)
by mtklein 11mo ago
I think this is _Alignas/alignas.
struct foo {
_Alignas(64) float x,y;
_Alignas(64) int z;
};
_Static_assert(sizeof(struct foo) == 192, "");
- danudey 11mo agoThe example I linked uses alignas, but the key is knowing what value to pass. std::hardware_destructive_interference_size tells you what the current/target hardware's correct align value is, which is the challenge.