I worked on a code base using the LEON (SPARC, big-endian) and also ARM in little-endian mode for space. The code was common for both endians. I followed the sage advice of Rob Pike on it:
https://commandcenter.blogspot.com/2012/04/byte-order-fallac...