5

我通过十六进制编辑器打开了一个波形文件。我尝试了两个十六进制编辑器,并且都以相反的顺序将 44100 放入十六进制(AC44)。

这是为什么?对于 ASCII 字符“fmt”,排序是自然的。

在此处输入图像描述

这是AC44。

在此处输入图像描述

这与Big-Endian / Little-Endian有关吗?但是为什么其他值会以正确的顺序显示呢?

谢谢!

4

4 回答 4

6

Yes, it is stored in little endian format. The endianness of each field is shown here:

WAV format

Note that there is a mixture of big and little endian.

于 2011-11-01T20:47:00.003 回答
2

It does have to do with endian-ness. The data type you're writing to is an integer which gets stored as a multiple byte chunk.

The reason the text atoms look like they aren't reversed is because they are an ordered list of single byte characters.

于 2011-11-01T20:50:20.037 回答
1

Actually it depends on the architecture and/or file format, see e.g. here. You can find both cases, one where the high byte comes first and also where the low byte comes first. In your case it is the first (called litte endian).

于 2011-11-01T20:47:23.597 回答
1

因为您的十六进制编辑器正在打印从低地址到高地址的十六进制字节,而小端(例如 x86/ia32)机器将多字节实体的低位存储在低地址中。

如果您想以相反的顺序查看字节,您可以打印从高地址到低地址的内存(但仍然是从左到右),因为在英语国家通常以这种方式打印数字。

于 2011-11-02T02:42:10.567 回答