[tz] "Standard byte order"

Dave Cantor dave at davecantor.us
Fri Nov 4 17:27:20 UTC 2011



On 04-Nov-2011, Ian Abbott wrote:

> On 2011/11/04 04:23 PM, Ian Abbott wrote:
> > Okay, the high-order byte is written first, but it doesn't say
> > anything about the ordering of the remaining bytes of the four-
> > or eight-byte values.  (PDP-endian, anybody?) ;-)
> 
> Except that PDP-endian wouldn't have the high-order byte first, it
> would have one of the middle bytes (bits 23..16 for a four-byte
> value) first.

Yes, in PDP-11 storage, the lowest byte had the lowest memory 
address, but they were often written with the bytes swapped 
within each "word" (16 bits), so that a 32-bit value 0x76543210 
would have bytes in the order  0x32 0x10 0x76 0x54.  There were 
other permutations, too.   

Perhaps the documentation should say something like:

For the 16-bit value 0x3210, the bytes are 0x32 followed by 0x10.
For the 32-bit value 0x76543210, the bytes are in the order
   0x76 0x54 0x32 0x10    (is that the case?)
For the 64-bit value 0xFEDCBA9876543210, ...
For character data, the bytes are written leftmost character 
first, and sequentially as one would read them left to right in 
English, and terminated with a null byte.

Dave C.



More information about the tz mailing list