2.32 [5] <§2.8> Functions can often be implemented by compilers “in-line.”
An in-line function is when the body of the function is copied into the program space,
allowing the overhead of the function call to be eliminated.
Implement an “in-line” version of the the C code in the table in MIPS assembly.
What is the reduction in the total number of MIPS assembly instructions needed to complete the function?
Assume that the C variable n is initialized to 5.
function :
int fib(int n) {
if (n==0)
return 0;
else if (n==1)
return 1;
else
return fib(n-1) + fib(n-2);
}
大多回答是说
递回不适合用inline
原因在于程式码可能过大
但这题n只等于5
假如真的要放inline没办法得到答案吗
谢谢