I have a variant datatype using a union.
typedef union { 
    char        *string;
    int         integer; 
    ...
} vardata_t;
I have functions in variant.c that set the value. Many of these functions are trivial.
void variant_set_integer (variant_t *v, int val) { 
    assert (v->vartype == vartype_integer); 
    v->vardata.integer = val;                   
}
If I want execution to be as fast as possible and to optimize for speed, it is my understanding I should make the function static and put it in the header instead.
// variant.h
...
// Source files using this may inline via compiler optimizations
// Source files not using this will strip via compiler optimizations
static void variant_set_integer (variant_t *v, int val) { 
    assert (v->vartype == vartype_integer); 
    v->vardata.integer = val;                   
}
Is this the best and correct strategy for optimizing for speed allowing the compiler to best take advantage of situations where it determines inlining is the best solution?
NOTE: I'm trying to determine best automatic inlining practice for speed, not solve this specific example.
 
     
     
    