title: Using C intrinsics and memory alignment difficulties with classes
body: <p>Ok, so I am just starting to use C intrinsics in my code and I have created a class, which simplified looks like this:</p>
  
  <pre><code>class _Vector3D
  {
  public:
  _Vector3D() 
  {
      aVals[0] = _mm_setzero_ps();
      aVals[1] = _mm_setzero_ps();
      aVals[2] = _mm_setzero_ps();
  }
  ~_Vector3D() {}
  private:
  __m128 aVals[3];
  };
  </code></pre>
  
  <p>So far so good. But when I create a second class with _Vector3D members, I get problems:</p>
  
  <pre><code>class RayPacket
  {
  public:
  RayPacket() {orig = _Vector3D(); dir = _Vector3D(); power = _mm_setzero_ps();}
  ~RayPacket() {}
  
  RayPacket(_Vector3D origins, _Vector3D directions, float pow)
  {
      orig = origins;
      dir = directions;
      power = _mm_set_ps1(pow);
  }
  
  _Vector3D orig;
  _Vector3D dir;
  __m128 power;
  };
  </code></pre>
  
  <p>I get the following error: </p>
  
  <p>error C2719: 'origins': formal parameter with __declspec(align('16')) won't be aligned</p>
  
  <p>pointing to the constructor overload:</p>
  
  <pre><code>RayPacket(_Vector3D origins, _Vector3D directions, float pow)
  </code></pre>
  
  <p>So am I going about this the wrong way? Should I be using structs instead or can I make it work with classes?</p>