This code returns different answers between different architectures. Are these correct ?
I want this code to return same answer despite any architecture. Do I miss something?
Returns on x86_64-linux-gnu (Little endian):
length: 4
val: 204 187 170 0
length: 8
val: 255 238 221 204 187 170 0 0
Returns on powerpc-linux-gnu (Big endian, 32-bit):
length: 4
val: 0 170 187 204
length: 8
val: 0 0 170 187 204 221 238 255
I (cross-)compiled the code on a x86-64 machine and ran on each machine.
Cross compiler was built like following:
# rust
git clone https://github.com/rust-lang/rust.git
cd rust
./configure --target=powerpc-unknown-linux-gnu
make
make install
# cargo
git clone https://github.com/rust-lang/cargo
git submodule update --init
./.travis.install.deps.sh
./configure --local-rust-root=/usr/local \
make
make install
cd ~/.cargo
echo '[target.powerpc-unknown-linux-gnu]\n\
linker = "powerpc-linux-gnu-gcc"' > config
Thank you.