Annotation of coherent/a/usr/man/ALL/byteordering, revision 1.1

1.1     ! root        1: 
        !             2: 
        !             3: byte ordering         Technical information         byte ordering
        !             4: 
        !             5: 
        !             6: 
        !             7: 
        !             8: Machine-dependent ordering of bytes
        !             9: 
        !            10: 
        !            11: Byte ordering  is the order in which a  given machine stores suc-
        !            12: cessive bytes of a multibyte data item.  Different machines order
        !            13: bytes differently.
        !            14: 
        !            15: The following example displays  a few simple examples of byte or-
        !            16: dering:
        !            17: 
        !            18: 
        !            19: main()
        !            20: {
        !            21:         union
        !            22:         {
        !            23:                 char b[4];
        !            24:                 int i[2];
        !            25:                 long l;
        !            26:         } u;
        !            27:         u.l = 0x12345678L;
        !            28: 
        !            29: 
        !            30: 
        !            31:         printf("%x %x %x %x\n",
        !            32:                 u.b[0], u.b[1], u.b[2], u.b[3]);
        !            33:         printf("%x %x\n", u.i[0], u.i[1]);
        !            34:         printf("%lx\n", u.l);
        !            35: }
        !            36: 
        !            37: 
        !            38: When run  on ``big-endian'' machines,  such as the  M68000 or the
        !            39: Z8000, the program gives the following results:
        !            40: 
        !            41: 
        !            42:         12 34 56 78
        !            43:         1234 5678
        !            44:         12345678
        !            45: 
        !            46: 
        !            47: As you  can see, the  order of bytes  and words from  low to high
        !            48: memory is the same as is represented on the screen.
        !            49: 
        !            50: However, when this  program is run on ``little-endian'' machines,
        !            51: such as the PDP-11, you see these results:
        !            52: 
        !            53: 
        !            54:         34 12 78 56
        !            55:         1234 5678
        !            56:         12345678
        !            57: 
        !            58: 
        !            59: As  you can  see, the  PDP-11 inverts the  order of  bytes within
        !            60: words in memory.
        !            61: 
        !            62: 
        !            63: 
        !            64: COHERENT Lexicon                                           Page 1
        !            65: 
        !            66: 
        !            67: 
        !            68: 
        !            69: byte ordering         Technical information         byte ordering
        !            70: 
        !            71: 
        !            72: 
        !            73: Finally,  when the  program is  run  on the  i8086 you  see these
        !            74: results:
        !            75: 
        !            76: 
        !            77:         78 56 34 12
        !            78:         5678 1234
        !            79:         12345678
        !            80: 
        !            81: 
        !            82: The i8086 inverts both words and long words.
        !            83: 
        !            84: ***** See Also *****
        !            85: 
        !            86: C language, canon.h, data formats, technical information
        !            87: 
        !            88: 
        !            89: 
        !            90: 
        !            91: 
        !            92: 
        !            93: 
        !            94: 
        !            95: 
        !            96: 
        !            97: 
        !            98: 
        !            99: 
        !           100: 
        !           101: 
        !           102: 
        !           103: 
        !           104: 
        !           105: 
        !           106: 
        !           107: 
        !           108: 
        !           109: 
        !           110: 
        !           111: 
        !           112: 
        !           113: 
        !           114: 
        !           115: 
        !           116: 
        !           117: 
        !           118: 
        !           119: 
        !           120: 
        !           121: 
        !           122: 
        !           123: 
        !           124: 
        !           125: 
        !           126: 
        !           127: 
        !           128: 
        !           129: 
        !           130: COHERENT Lexicon                                           Page 2
        !           131: 
        !           132: 

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.