Shameless Self-Promotion dept.: You might want to read the wiki page
Why function implementations shouldn't be put In header files for a fuller discussion on this topic.
R3DC0DE wrote:
One last question : is it better to static inline them or to move them in their own .c file ?
For inlining, it really depends on the function; mostly, how large they are, how often they are called and where, and whether there is a reason to avoid having a function call/return pair and the necessary preamble/exit code which goes with a fully-fledged function.
Looking at the specific functions you mentioned, I would have the
port_* functions as
static inline, since the goal is to insert a single inline assembly instruction into the code referring to them (modulo some automagically generated register shuffling, perhaps).
However, these are precisely the sort of use case
static inline is intended for. In general, you don't want to inline a function which doesn't need to be inlined.
(Also, as I said to someone else
in another thread recently, it is worth bearing in mind that
inline functions and inline assembly are two separate things, even if they sometimes go together.)