   Assembly vectors
  I discovered a couple of neat SSE instructions while trying to write some vector routines in assembly. Isn''t that quite efficient? are there any further ways I can improve on this?Too bad that not everyone has SSE..cpp file:struct vector_t {float x, y, z, w;};extern "C" {inline void vec_add(vector_t *v1, vector_t *v2, vector_t *dest);}.asm file:_vec_add:movedx, [esp+4]movapsxmm0, [edx]movedx, [esp+8]addpsxmm0, [edx]movedx, [esp+12]movaps[edx], xmm0ret 
  No (if processing lots of vec_adds, you may want to write a tight assembly loop though).Just be aware that code (through usage of the fast movaps instead of the slow-but-supports-"unaligned" movups) assumes that your vectors are 16-byte aligned. ;  How do I align the vectors then? the code works, but may be by accident. ;  Look at #pragma pack() ;  Would I use #pragma pack 4, 8 or 16? And do I just use it once in my source file and everything is ok? ;  Should it be like this?#pragma pack(4)struct vector_t {float x, y, z, w;};#pragma pack()And should I align to 4? ;  For reference:pragma pack"When you use #pragma pack(n), where n is 1, 2, 4, 8, or 16, each structure member after the first is stored on the smaller member type or n-byte boundaries."Given that floats take 32 bits, 4 works.  