I have a CRC calculation function which gets called with extremely high frequency. I have already declared as inline
i tried making it a __attribute((hot))__
but i am not sure if that buys anything. I am thinking about making it a fastcall
.
According to gcc docs ,
fastcall On the Intel 386, the fastcall attribute causes the compiler to pass the first argument (if of integral type) in the register ECX and the second argument (if of integral type) in the register EDX. Subsequent and other typed arguments are passed on the stack. The called function will pop the arguments off the stack. If the number of arguments is variable all arguments are pushed on the stack.
fastcall
would make it essentially faster because input params would be sent through registers instead of pushing them on to the stack. with inline
, compiler would replace the function call with the body of the function .
So question is does fastcall
when used with inline
even make sense ?