Little Endian vs Big Endian的例子

问题描述 投票:0回答:1

我有这些十六进制数:

0xAF2B,我必须计算小和大端。

我得到了这样的记忆:a;一个+ 1;一个+ 2;一个+ 3。

你能说出这是否正确吗?

0xAF2B

  1. Little Endian:a = 2B,a + 1 = AF,a + 2 = 00,a + 3 = 00
  2. Big Endian:a = AF,a + 1 = 2B,a + 2 = 00,a + 3 = 00
memory memory-management endianness
1个回答
0
投票

小端是正确的。但是大端是不正确的。

您的数字似乎有4个字节,在4个字节上,您的数字是0x00.00.AF.2B

因此,在大端计算机上,内存中的字节排列将是

a=0     MSB (big) comes first       
a+1=0  
a+2=AF  
a+3=2B  LSB last
© www.soinside.com 2019 - 2024. All rights reserved.