Why doesn't compile functions like pinMod to required instructions !

Please provide a compilable replacement for e.g. pinMode() as to how you think it can work; it needs to support two processors (e.g. 328P for Uno and 2560 for Mega).

There really is not that much bloat in pinMode(), at least not for AVR based processors.

  1. Determine the bit in the register that needs to be changed.
  2. Determine the register to be changed.
  3. Write the register based on the required mode.

There is a little additional stuff to harden the code.