Attempt to make the implementation endianness-independent