Tuesday, July 20, 2010

CVector Class with Inline ASM and SSC

I am going to up load this now, for your impatiens that wish to know how to do the vector class, an later(in a week) I will explain each and every line of assembly and the code.


Notes: movaps, moves memmory registers of 128 bits(16 bytes), 4 float or 4 ints


CVector CLass definition using inline ASM


#include"CVector.h"
#include <math.h>
#include <stdio.h>

// Constructor
CVector::CVector(CVector& v)
{
__asm
{
mov EDI,v // We point to v with EDI
movaps xmm0,[EDI] // The value pointed is copied to xmm0
mov ESI,this // ESI points to the class base pointer
movaps [ESI],xmm0 // the value of v(xmm0) is copied to this([esi])
}
}

Download Visual C++ 2008 Project

No comments: