Fixed typos
Moved __builtin's to macros for portability
Emulator args are now stored by value instead of by reference