Big-Endian And Little-Endian
2007-07-07 11:32
375 查看
今天老师给我们复习单片机,出了一个题目,就这个字节存储顺序搞得人晕死了。就在网上找了下文章,如下:
Sockets has functions to convert Long and Short Integers to and from Internet standard byte ordering, which is Big Endian.
htonl, convert host-to-network, long integer
htons, convert host-to-network, short integer
ntohl, convert network-to-host, long integer
ntohs, convert network-to-host, short integer
Big Endian systems such as HP-UX and MPE are already compatible with the network ordering, so they can define these functions as null macros.
The Power PC is a big-endian processor; that is, it supports both big- and little-endian addressing modes. This bi-endian architecture enables software developers to choose either mode when migrating OSes and applications from other machines.
TraceBack: http://www.robelle.com/library/smugbook/byteordr.html
tanzek 2007-07-07 11:32 发表评论
Byte Order in Multibyte Values
HP, IBM and Motorola 68000 systems store multibyte values in Big Endian order, while Intel 80x86 and DEC VAX systems store them in Little Endian order. Big Endian stores the high-order byte at the starting address while Little Endian stores the low-order byte at the starting address. The low-order byte contains the bits for the lowest possible values, that is, 0-255, while the high-order byte contains the bits that specify the large values (that is, 256-65535 in a short integer). (The term endian is derived from a passage in Jonathan Swift's Gulliver's Travels). Swapping integer data between computers of different types is a difficult problem unless you convert the information into ASCII characters.Sockets has functions to convert Long and Short Integers to and from Internet standard byte ordering, which is Big Endian.
htonl, convert host-to-network, long integer
htons, convert host-to-network, short integer
ntohl, convert network-to-host, long integer
ntohs, convert network-to-host, short integer
Big Endian systems such as HP-UX and MPE are already compatible with the network ordering, so they can define these functions as null macros.
The Power PC is a big-endian processor; that is, it supports both big- and little-endian addressing modes. This bi-endian architecture enables software developers to choose either mode when migrating OSes and applications from other machines.
TraceBack: http://www.robelle.com/library/smugbook/byteordr.html
tanzek 2007-07-07 11:32 发表评论
相关文章推荐
- 大端和小端(Big endian and Little endian)
- 大端和小端(Big endian and Little endian)
- 大端和小端(Big endian and Little endian)
- Big endian and Little endian
- big endian and little endian
- Big-Endian and Little-Endian Test in Arm and PowerPC CPU
- Big-Endian and Little-Endian Test in ARM and PowerPC SoC
- Big endian and Little endian
- 大小端模式little endian and big endian
- big and little endian
- Difference between big-endian and little-endian
- 大端和小端(Big endian and Little endian)
- 操作系统 大端和小端(Big endian and Little endian)
- Big-endian and Little-endian
- Big-endian and little-endian
- Big-Endian and Little-Endian
- CSAPP:Big endian and Little endian
- 关于字节在内在存放的顺序(Big Endian and Little Endian)
- little-endian And big-endian
- compiled for a little endian system and target is big endian