Differences between version 8 and previous revision of Endian.
Other diffs: Previous Major Revision, Previous Author, or view the Annotated Edit History
Newer page: | version 8 | Last edited on Saturday, March 19, 2005 10:58:23 am | by AristotlePagaltzis | Revert |
Older page: | version 7 | Last edited on Thursday, February 24, 2005 12:59:58 pm | by JohnMcPherson | Revert |
@@ -1,38 +1 @@
-The order of bytes stored/sent in a computer. For example if the number 0x01020304 is sent as the 4 bytes "01 02 03 04" then it is BigEndian. If it's sent as "04 03 02 01" then it is LittleEndian.
-
-There is also the somewhat bizzare PDP-endian "02 01 04 03" - probably due to an attempt at backwards compatibility in the transition from 1-byte to 2-byte integers, and no such attempt from 2-byte to 4-byte integers. (A little googling will probably discover the reason for this endian-ness.)
-
-NetworkByteOrder is usually BigEndian, and HostByteOrder is LittleEndian for Intels (Although almost everyone else is BigEndian these days).
-
-
-Big-endian systems:
[SGI
] Irix ([MIPS] [CPU]) and Indys, [IBM] RS6000 & [Apple] Powermac (Power/[PowerPC]), SUN (Sparc)
-
-little-endian systems: (DEC [Alpha], Intel [x86] & compatibles like [AMD])
-
-Humans are "BigEndian", we write numbers as "1234" not "4321"
-
-----
-[C] program to demonstrate this:
-
- $ cat > x
.c
- #include <stdio.h>
- #include <fcntl.h>
- int main() {
- int x=0xaabbccdd;
- int fd=open("/tmp/output", O_CREAT|O_EXCL|O_WRONLY, 0644);
- return write(fd, &x, sizeof(int));
- }
-
- $ gcc -o x x.c
- $ ./x
- $ od -t x1 /tmp/output
- 0000000 dd cc bb aa
- 0000004
-
-This shows that (on an [x86] system) the bytes "aa bb cc dd" were
-stored as "dd cc bb aa".
-
-Doing the same thing on a [SPARC] gives the (more intuitive):
- $ od -t x1 /tmp/output
- 0000000 aa bb cc dd
- 0000004
+Describe
[Endian
] here
.