BIG-Endian and Little-Endian

xiaoxiao2021-03-06  38

in short:

BIG Endian Machine: IT Thinks The First Byte It Reads Is The Biggest.

Little Endian Machine: IT Thinks The First Byte It Reads Is The Littlest.

For example, you have the following data from the memory address 0x0000

0x0000 0x12

0x0001 0x34

0x0002 0xAb

0x0003 0xcd

If we read an address of the four byte variables 0x0000, if the character sequence is BIG-Endian, read it

The result is 0x1234ABCD; if the byte sequence Little-Endian, the read result is 0xcdAb3412.

If we write 0x1234ABCD to memory started with 0x0000, the result is

Big-endian Little-Endian

0x0000 0x12 0xcd

0x0001 0x23 0xAb

0x0002 0xAb 0x34

0x0003 0xcd 0x12

The X86 series CPUs are both literal-endian's byte sequence.

Reprinted: www.donews.net

转载请注明原文地址:https://www.9cbs.com/read-51181.html

New Post(0)