Little Endian vs Big Endian
Big Endian = 0x31014950 Little Endian = 0x50490131
However Using this Method
inline unsigned int endian
The example in your edit is outputting y not r. The input y is, of course, not modified.