How much of my math classes should I inline?

Started by
3 comments, last by lucinpub 19 years, 2 months ago
The topic title says it all: How much of my math classes (like Matrix, Vector, Quat, etc) should I inline? Should I inline ALL of the functions, or only the simple ones? What is the point at which inlining a function becomes cumbersome?
Advertisement
When I wrote my math library, I inlined every function except complex ones. By 'complex ones', I mean functions such as a matrix inverse function, or a function to build a view or projection matrix (because they're called very infrequently).

However, if this is for a Direct3D project, and you're not doing this just for the fun of it, I'd recommend using the D3DX library, since it's highly optimized.
Yes i agree, use D3DX, its written for you :)

I would also like to add that the inline keyword is only suggestive. The compiler will choose how to implement ur code, but inlining it will tell the compiler how u would like it.

ace
Thanks!
I'll keep that in mind. I'm actually using OpenGL, though, so no D3DX for meh.
Although I don't want to get into an argument with D3D coders -- OGL > D3D :P.
If you have a few $ to spend, the first game programming gems book has a math lib ( at least matrixes ) on the cd which wasn't bad, iirc.
Lucas Henekswww.ionforge.com

This topic is closed to new replies.

Advertisement