On Sat, 11 Jun 2016, RW wrote:

On Fri, 10 Jun 2016 15:38:44 -0400
Joseph Brennan wrote:


This is a nice test I found:
echo -n I | od -to2 | awk '{ print substr($2,6,1); exit}'

1 little-endian
0 big-endian

I don't see how this can output anything other than 1.

Endianness is about the addressing of bytes within integer words. This
is looking at the ordering of human-readable octal digits displaying
the contents of a single byte.

On big-endian system:

  $ echo -n I | od -to2
  0000000    044400
  0000001

On little-endian system:

  # echo -n I | od -to2
  0000000    000111
  0000001

So it works.
It's a single data byte but since the display field is a two byte
object, where within that two byte object does that single byte show up?

--
Dave Funk                                  University of Iowa
<dbfunk (at) engineering.uiowa.edu>        College of Engineering
319/335-5751   FAX: 319/384-0549           1256 Seamans Center
Sys_admin/Postmaster/cell_admin            Iowa City, IA 52242-1527
#include <std_disclaimer.h>
Better is not better, 'standard' is better. B{

Reply via email to