Difference between revisions of "Big endian"

From Linuxintro
imported>ThorstenStaerk
imported>ThorstenStaerk
Line 21: Line 21:
 
  1 byte (1 B) copied, 4.436e-05 s, 22.5 kB/s
 
  1 byte (1 B) copied, 4.436e-05 s, 22.5 kB/s
 
  0000000 0065
 
  0000000 0065
 +
0000001
 +
Let's read the 5th byte:
 +
tstaerk@little:~> dd if=test bs=1 count=1 skip=4 | hexdump
 +
1+0 records in
 +
1+0 records out
 +
1 byte (1 B) copied, 4.533e-05 s, 22.1 kB/s
 +
0000000 00c3
 
  0000001
 
  0000001

Revision as of 11:36, 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

Let's read the 5th byte:

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