Difference between revisions of "Big endian"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 8: Line 8:
 
  0000000 6568 6c6c b6c3 7720 726f 646c 000a
 
  0000000 6568 6c6c b6c3 7720 726f 646c 000a
 
  000000d
 
  000000d
OK, we have a file that contains the string "hellö world".
+
OK, we have a file that contains the string "hellö world". We read the first byte and it is a "h":
 
  tstaerk@little:~> dd if=test bs=1 count=1 | hexdump
 
  tstaerk@little:~> dd if=test bs=1 count=1 | hexdump
 
  0000000 0068
 
  0000000 0068
Line 15: Line 15:
 
  1+0 records out
 
  1+0 records out
 
  1 byte (1 B) copied, 0.00075077 s, 1.3 kB/s
 
  1 byte (1 B) copied, 0.00075077 s, 1.3 kB/s
  tstaerk@d3ll:~> dd if=test bs=1 count=1 skip=1 | hexdump
+
We read the second byte and it is an "e":
 +
  tstaerk@little:~> dd if=test bs=1 count=1 skip=1 | hexdump
 
  1+0 records in
 
  1+0 records in
 
  1+0 records out
 
  1+0 records out

Revision as of 11:34, 12 December 2010

Today I am experimenting with my big endian (PowerPC) machine

tstaerk@little:~> cat >test
hellö world
tstaerk@little:~> cat test
hellö world
tstaerk@little:~> hexdump test
0000000 6568 6c6c b6c3 7720 726f 646c 000a
000000d

OK, we have a file that contains the string "hellö world". We read the first byte and it is a "h":

tstaerk@little:~> dd if=test bs=1 count=1 | hexdump
0000000 0068
0000001
1+0 records in
1+0 records out
1 byte (1 B) copied, 0.00075077 s, 1.3 kB/s

We read the second byte and it is an "e":

tstaerk@little:~> dd if=test bs=1 count=1 skip=1 | hexdump
1+0 records in
1+0 records out
1 byte (1 B) copied, 4.436e-05 s, 22.5 kB/s
0000000 0065
0000001