SSE2 Cast issue in vector array

  c++, intrinsics, sse2

So, I’ve been developing a vector library for a game, and there’s a return function I’ve created which regularly would look something like this:

float& _mm_vec::operator[]( int _mm0 )
{
    {
        return ( ( float* )this )[_mm0]; 
    }
}

However, what I’m working on requires that it runs very fast ( which is why I’m using SSE2 ) as it will be used a LOT, and multiple times per-frame.

While looking in the intrinsics guide, I couldn’t find anything related to a cast instruction of such regarding ( float* ). Maybe I missed it, but I’ve been sitting here for an hour trying to figure out the conversion of this array…

Anyone have an idea on how this could be resolved?

Source: Windows Questions C++

LEAVE A COMMENT