I'm writing a couple wrapper classes for the SSE Intrinsics - mostly to get type-safe geometry operations, but also to add a couple convenience functions. All my functions and operators are inline. In theory, they'll all compile directly to raw SSE assembly (no function calls), and my electrons will never leave the XMM registers.
How do I pass my SSE classes as arguments to ensure this result?
I never modify my arguments, so the choice is mostly between passing by value or passing by const reference. I assume a good compiler will optimize both styles down the same code. But I don't know that for sure. Can someone with more experience in the area expound on the best practices?
Thanks in advance!
Either is fine for most compilers, but If you want the code to compile with Visual Studio then use const references, as the Visual Studio compiler is somewhat brain-dead and applies unnecessary ABI restrictions even when the function is inline.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With