On Sun, 12 Jun 2016 00:04:49 -0500 (CDT)
Dave Funk wrote:

> 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?

I don't use od much. FWIW, what I was missing is that od will have to
pad the input to get an even number of bytes, so it's effectively
working with "I\0".

Reply via email to