- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Code:
The question is :
class Vec3_SSE
{
public:
union
{
ALIGN16( float V[3] );
struct
{
float x,y,z;
};
};
Vec3_SSE()
{
x=0.0f;
y=0.0f;
z=0.0f;
}
Vec3_SSE(float _x,float _y,float _z)
{
x=_x;
y=_y;
z=_z;
};
inline float Normalize(void);//normalizes vector 3d
};
/////////////////////////////////////////////////////////////////////////////////
float Vec3_SSE::Normalize(void)
{
float d;
__asm
{
mov edi, this
movaps xmm0, [edi]
movaps xmm1, xmm0
mulps xmm1, xmm1
haddps xmm1, xmm1
haddps xmm1, xmm1
sqrtps xmm1, xmm1
movss d, xmm1
rcpps xmm1, xmm1
mulps xmm0, xmm1
movaps [edi], xmm0 //can this lead to memory overrun?
}
return d;
}
The question is :
Can Iget memory corruption by movinga 128 bit register contents to a 96 bit memory location?
At a first glance everything works fine.
Link Copied
0 Replies
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page