4 ms·
as long as basic things like __alignment__ are still fundamentally broken I simply do not care about the syntax. (I mean it doesn't get anything more basic than
by abductee_hg 7y ago
as long as basic things like __alignment__ are still fundamentally broken I simply do not care about the syntax.
(I mean it doesn't get anything more basic than this, no?)
- edflsafoiewq 7y agoWhat's wrong with alignment?
- abductee_hg 7y agowell there is this: #ifdef _MSC_VER __declspec( align(16) ) struct float4 { float v[4]; }; #else struct float4 { float v[4]; } __attribute__ ((aligned(16))); #endif but the main problem ist tthat alignment is _not_ part of the typing system. ( alignas vs alignof ) butt, to put it more general: 90% of your performance is in memory access and compilers are rubbish optimizing those, they are however getting increasingly good at the 10%. see also https://www.youtube.com/watch?v=rX0ItVEVjHc https://www.youtube.com/watch?v=rX0ItVEVjHc for realworld examples/exploration
- account42 7y ago> well there is this: #ifdef _MSC_VER __declspec( align(16) ) struct float4 { float v[4]; }; #else struct float4 { float v[4]; } __attribute__ ((aligned(16))); #endif I don't understand what you are trying to say here? Why not just use struct alignas(16) float4 { float v[4]; }; You can even put both __declspec( align(16) ) and __attribute__ ((aligned(16))) in the same place if you want to have a fallback for older compilers.