Got rid of endian specific code (portability)

Also updated the cmake build to work in Windows.