I\'m re-writing a small C math library of mine that will end up as a static library for the user and would like to benefit from inlining for my vector math interface.
<
You should define your function as static inline in the .h file:
static inline float clampf( float v, float min, float max )
{
if( v < min ) v = min;
if( v > max ) v = max;
return v;
}
The function must be absent in the .c file.
The compiler may decide not to inline the function but make it a proper function call. So every generated .o file may contain a copy of the function.