Types of endianness

后端 未结 8 1259
情话喂你
情话喂你 2020-12-04 22:57

What is the difference between the following types of endianness?

  • byte (8b) invariant big and little endianness
  • half-word (16b) invariant big and litt
8条回答
  •  佛祖请我去吃肉
    2020-12-04 23:27

    Actually, I'd describe the endianness of a machine as the order of bytes inside of a word, and not the order of bits.

    By "bytes" up there I mean the "smallest unit of memory the architecture can manage individually". So, if the smallest unit is 16 bits long (what in x86 would be called a word) then a 32 bit "word" representing the value 0xFFFF0000 could be stored like this:

    FFFF 0000
    

    or this:

    0000 FFFF
    

    in memory, depending on endianness.

    So, if you have 8-bit endianness, it means that every word consisting of 16 bits, will be stored as:

    FF 00
    

    or:

    00 FF
    

    and so on.

提交回复
热议问题