changed ENDIANSWAP macro to be more efficient