title: memory not aligned properly?
body: <p>I'm trying to use aligned operations in SSE and I'm having an issue (surprise).</p>
  
  <pre><code>typedef struct _declspec(align(16)) Vec4 {  
      float x;  
      float y;  
      float z;  
      float w;  
  };
  
  Vec4 SSE_Add(const Vec4 &amp;a, const Vec4 &amp;b) {  
      _declspec(align(16)) Vec4 return_val;  
  
      _asm { 
          MOV EAX, a                    // Load pointers into CPU regs
          MOV EBX, b
  
          MOVAPS XMM0, [EAX]            // Move unaligned vectors to SSE regs
          MOVAPS XMM1, [EBX]
  
          ADDPS XMM0, XMM1              // Add vector elements
          MOVAPS [return_val], XMM0     // Save the return vector
      }
  
      return return_val;
  }
  </code></pre>
  
  <p>I get an access violation at <code>return return_val</code>. Is this an alignment issue? How can I correct this? </p>