Inline functions


In many cases the compiler replaces a function call by a copy of the function block. This saves time (no need to push/pop the return address), but if you have a function which is called at various locations of your program it takes multiple space in the flash memory. To avoid this there is the noinline attribute. Example:

byte bitCount(byte x) __attribute__((noinline)); // inline take 20 bytes more per call
byte bitCount(byte x) {
  const byte z[16] = {0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4};
  return z[x & 15] + z[x / 16];
}



contact: nji(at)gmx.de