big and little endian

总是容易搞混big endian 和 little endian,但是找到一篇文章,其解释让人耳目一新。

文章链接:http://www.cs.umd.edu/class/sum2003/cmsc311/Notes/Data/endian.html

假设内存 byte-addresseable,假设我们要保存一个32bit的数据,以16进制表示为 90AB12CD。

有两种保存方式:

1. store the most significant byte in the smallest address,也就是所谓的 big endian。

2. store the least significant byte in the smallest address,也就是所谓的 little endian。

因为 the least significant byte is stored first,所以叫 little endian.

因为 the most significant byte is stored first,所以叫 big endian.

文章中介绍的内容包括但不限于这些,还介绍了 endian 的影响之类的内容。

原文地址:https://www.cnblogs.com/vanwoos/p/6940516.html