To test endian related code, need to test on both a big-endian machine and little-endian machine. Unless the host machine is an ARM machine that supports switching endianess, or using build agents of both types, the best way is to use emulation. For testing, perhaps the easiest emulator to set up for this task is QEMU.
(Ref: https://create.stephan-brumme.com/big-endian/)
On MacOS:
brew install qemu
On Ubuntu Linux:
apt-get install qemu
On RedHat Linux:
yum install qemu
On Windows:
download something ??
Download the VM image:
https://create.stephan-brumme.com/big-endian/debian-wheezy-powerpc.qcow2
Run the VM:
qemu-system-ppc -hda ./debian-wheezy-powerpc.qcow2 -L bios -m 512M -net user,hostfwd=tcp::2222-:22 -net nic &
Need to set up passwordless login to the VM:
if [ ! -f ~/.ssh/id_rsa.pub ] then ssh-keygen -t rsa -P "your-passphrase" fi ssh-copy-id -p2222 root@localhost
Enter password of 'root'. After this, the password won't be needed again.