error C2719: 'n3': formal parameter with __declspec(align('16')) won't be aligned
The code is:
struct float4x4
{
__m128 m0;
__m128 m1;
__m128 m2;
__m128 m3;
float4x4 (__m128 n0, __m128 n1, __m128 n2, __m128 n3): m0(n0), m1(n1), m2(n2), m3(n3) {}
// ...snip...
};
The thing I can't understand is that the error only shows up on n3, the last row of the matrix. My 3x3 matrix does just the same thing and it works fine:
struct float3x3
{
__m128 m0;
__m128 m1;
__m128 m2;
float3x3 (__m128 n0, __m128 n1, __m128 n2): m0(n0), m1(n1), m2(n2) {}
// ...snip...
};
So...what's the deal? The compiler is smart enough to align 3 parameters properly, but can't handle 4?
I'm guessing I'm just going to have to declare all these things to take const-references instead of __m128 by value (a bit of Googling has suggested that __m128 by value isn't considered quite safe in general, although that seems a bit silly to me). Hopefully the references will get optimized away and not *actually* forced into memory all the time...












