Page 1 of 1

How to test big-endian code?

Posted: Fri May 04, 2018 5:50 am
by Solar
I have a piece of code that does some bit-fiddling, which should work on Little Endian and Big Endian alike.

Unfortunately the company has shut down the last of the AIX boxes (that I had access to), which were my go-to point to test BE code.

So... how do you test big-endian code? Online compilers like ideone.com are all LE. Emulation? Some small board / box that runs a BE Linux? I'd probably even be willing to shell out a couple of bucks if it gave me a big-endian testbed. One I could use to test heavily C++17-ish code...

Re: How to test big-endian code?

Posted: Fri May 04, 2018 6:40 am
by zaval
I bought for myself iMac g5. openbsd and linux can run on it.
it's even 64 bit. theoretically. with 512MB of RAM. :mrgreen:

Re: How to test big-endian code?

Posted: Fri May 04, 2018 6:51 am
by davidv1992
You could also look into using some ARM based board, as arm still supports both endian conventions.

Re: How to test big-endian code?

Posted: Fri May 04, 2018 7:06 am
by Solar
RaspberryPi draws a blank, as does Arduino...

Re: How to test big-endian code?

Posted: Fri May 04, 2018 8:50 am
by iansjack
How about an old SPARC box from eBay? Buy-it-nows for about £50 in UK. You might strike lucky with an auctioned one.

Re: How to test big-endian code?

Posted: Fri May 04, 2018 8:59 am
by Schol-R-LEA
I would start by trying it in QEMU emulating MIPS BE (which is actually the default for MIPS on QEMU; the MIPS little-endian emulation is given as 'mipsel' rather than 'mips').

Re: How to test big-endian code?

Posted: Fri May 04, 2018 9:18 am
by iansjack

Re: How to test big-endian code?

Posted: Tue May 08, 2018 12:19 pm
by Solar
I think I have completed the circle, coming back home.

I installed WinUAE (which, being the owner of a licensed copy of AmigaForever, I have the ROM and OS files for), downloaded the DICE C compiler, and by putting the bit-fiddling stuff into out-of-context C files, am now able to put the Endian-dependent logic to the actual test.

Not quite what I would have preferred, but a workable solution.

And it feels like it was just yesterday, seeing the Amiga Workbench again...

Re: How to test big-endian code?

Posted: Mon Jun 04, 2018 2:22 am
by Solar
Actually a good friend of mine happened to have an A3000 in his garage, complete with a SCSI hard drive. (The A3000 being the only Amiga that ever came with a MMU out-of-the-box -- you need the MMU to run a Unix on it.) The beauty is now sitting in my room, pending a test run after almost two decades of inactivity.

If it doesn't work out, the UAE / C solution is good enough for me.

(Auctioned Amigas are anything but cheap. The nostalgics associated with the platform, combined with the scarcity of late-era hardware, made prices go up instead of down over time...)