Intel and Motorola numbering systems
I was just wondering, what are the Intel and Motorola numbering systems? What are the differences?
/. Muzzafarath
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Do you mean little-endian vs. big-endian? That''s not exclusive to Intel vs. Motorola. (Just the two most famous examples.) Basically for a multiple byte integers, it refers to the bit order in memory.
Let''s say I had the integer 0x1234 in at address 0x1000 on both processors. On intel it would look like:
0x1000 : 00000100
0x1001 : 00000011
0x1002 : 00000010
0x1003 : 00000001
On motorola it would look like:
0x1000 : 00000001
0x1001 : 00000010
0x1002 : 00000011
0x1003 : 00000100
Let''s say I had the integer 0x1234 in at address 0x1000 on both processors. On intel it would look like:
0x1000 : 00000100
0x1001 : 00000011
0x1002 : 00000010
0x1003 : 00000001
On motorola it would look like:
0x1000 : 00000001
0x1001 : 00000010
0x1002 : 00000011
0x1003 : 00000100
The diffrence is in how they are storing bytes in memory. Motorola processors are big endian and Intel processors are little endian.
I was writting my post when SiCrane had send his
Edited by - QWERTY on 3/27/00 11:41:27 AM
I was writting my post when SiCrane had send his

Edited by - QWERTY on 3/27/00 11:41:27 AM
Useless trivia: anybody know WHY they''re called big-endian & little-endian (i.e. where the terms originate)?
Yes. As a matter of fact I do. Has to do with eggs. Do you want me to say more, or should I keep it to myself for a little while longer?
What is the purpose of having two "endians" (whatever endian means)?
/. Muzzafarath
/. Muzzafarath
I'm reminded of the day my daughter came in, looked over my shoulder at some Perl 4 code, and said, "What is that, swearing?" - Larry Wall
Ok, on a big-endian machine the bits are layed out in memory like you would expect them to be:
0x74321234 would look like
0x1000 : 74 32 12 34
in a hex editor
On a little-endian machine the bits are layed out in reverse byte order:
0x1000: 34 12 32 74
The big-endian machine just makes a little more arithmetic sense. And is probably easier to wire too.
A little-endian machine makes casts down easier. Lets take for example you want to add a short to a long and store it as a short.
short a = 0x0012;
long b = 0x00001234;
Now an big-endian machine you have:
&b : 00 00 12 34
so what the machine code emits looks sort of like
c = a + (short)(*(&b + 2));
On a little-endian machine you have:
&b : 34 12 00 00
so the machine code looks just like
c = a + (short)(b);
0x74321234 would look like
0x1000 : 74 32 12 34
in a hex editor
On a little-endian machine the bits are layed out in reverse byte order:
0x1000: 34 12 32 74
The big-endian machine just makes a little more arithmetic sense. And is probably easier to wire too.
A little-endian machine makes casts down easier. Lets take for example you want to add a short to a long and store it as a short.
short a = 0x0012;
long b = 0x00001234;
Now an big-endian machine you have:
&b : 00 00 12 34
so what the machine code emits looks sort of like
c = a + (short)(*(&b + 2));
On a little-endian machine you have:
&b : 34 12 00 00
so the machine code looks just like
c = a + (short)(b);
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement