Implement some core typemaps as functions

The functions are compiled with GCC and will likely be faster than the
inlined macros compiled by TCC.