Re: Endian'ess.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>>>>> "amith" == amith  <amith@multitech.co.in> writes:
amith> Now, i have a couple of doubts :
amith> 1) i read somewhere on the net, that a processor can be set to either
amith>    Little endian or Big endian, configurable ?

  As people already said, some are fixed endian (e.g. ia32), some are
h/w configurable (say with a processor pin), some are runtime
configurable (e.g. powerpc).

amith> 2) Could someone explain this with respect to the Little Endian
amith>    definition given above.


amith>   6004             6006
amith> _________________
amith> |    5678    |   1234      |
amith> |________|________ |
amith>  t1.w1          t1.w2

the int 0x12345678 occupies four bytes.  With little endian the
least-significant bytes are on lower addresses, i.e. the memory layout
is

 -------------------
| 78 | 56 | 34 | 12 |
 -------------------

whereas with big endian the least significant bytes are on higher
addresses, i.e.

 -------------------
| 12 | 34 | 56 | 78 |
 -------------------

  The same applies to two-byte integers, hence with little endian the
half integers are 0x5678 and 0x1234 (note that what is on lower
addresses is less significant), whereas with big endian they are
0x1234 and 0x5678 (because what is on lower addresses is more
significant).

  And as a side note, it's clear which is The Right Endian(tm): all
other things equal with big endian you can read memory dumps (unless
you're an Arab or Jewish, where it'd be easier to read little-endian
dumps from right to left :D )

~velco

--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux