Following is a typical code snippet you can use to determine if the operating environment is big-or little-endian; you can set a specific flag for your convenience. 您可以使用下面的典型代码片断来确定操作环境是big-endian还是little-endian;您可以方便地设置具体的标记。
Since SPARC is big-endian and x86 is little-endian, you need to consider endianness issues. 由于SPARC采用的是big-endian,而x86采用的是little-endian,因此您需要考虑endianness的问题。
Unfortunately, the Linux distribution used doesn't provide corresponding little-endian libraries to link with, so you can't test little-endian code. 不幸的是,所使用的Linux发行版并没有提供对应的低位优先库来进行链接,因此就不能对低位优先测试。
One thing to do is look for a number whose range you can predict broadly, and just see what it comes out as when read both big-endian and little-endian. 要做的一件事是寻找一个预测范围很大的数字,看一下当读取高位优先和低位优先时到底是什么情况。
The byte ordering ( Big-Endian or Little-Endian) for a storage access is specified by the operating system. 存储器存取的字节顺序(Big-Endian或Little-Endian)是由操作系统指定的。
Because x86 CPUs are little-endian, the value0x0042 is stored in memory as4200. 因为x86CPU是little-endian,值0x0042在内存中的存储形式是4200。
When students do these embedded experiments, they do often face the problem of the transformation between big-endian and little-endian about byte order. 学生在做嵌入式系统的实验时,经常会遇到字节顺序的大小端转化问题。