View Single Post
Old Apr 2nd, 2006, 1:42 PM   #1
Klarre
Game engine designer
 
Klarre's Avatar
 
Join Date: May 2005
Location: Sweden
Posts: 301
Rep Power: 4 Klarre is on a distinguished road
[x86, MASM] Design thoughts

I have this function written in C++, where a Vec3 is a structure with 3 floats.
Vec3 foo(Vec v1, Vec2 v2)
{
    Vec3 retVec;

    retVec.x = v1.x + v2.x;
    retVec.y = v1.y + v2.y;
    retVec.z = v1.z + v2.z;

    return retVec;
}
Now I want to rewrite this function into asm. But I need some design suggestions. How should you do this? Should I store the three values that retVec keeps after each other and return the adress to the first element? This is the only idea I can come up with.

Thanks for any suggestions!

/Klarre
Klarre is online now   Reply With Quote