Rewrite memory helper functions via memcpy
Remove endianness detection in build system