replace the byte swapping macros with the ones from platform.h rename and move things to match the rest of the code