Convert endian.cpp to C