Re: Question about Endian Order

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

 



dont get confused its simple !! everyting is in the name itself ::

-------------------------->inc addresses
LOW                                          HIGH address
+------------------------------------+
LSB(Note here)                        MSB                     :Little endian
MSB                                          LSB  (note here)  : Big endian



Hope that helps,



Onkar


Little(at what address ??? larger or smaller ? )   endian(this refers to LSB)

On Jan 23, 2008 1:17 PM, vichy < vichy.kuo@xxxxxxxxx> wrote:

Dear all:

While studying the kernel source code, I always confused with the Endian Order.

I have studied the article about Endian order on the net.

Usually they gave an example as below:

 

A 4 byte LongInt

    0xabcdefgh

will be arranged in memory as follows:

    Base Address+0   gh

    Base Address+1   ef

    Base Address+2   cd

    Base Address+3   ab

 

But what is the correct unit I should take to interpret the content of memory?

I purposely use data not 4-bytes alignment in the following questions.

 

Question 1:

What does the memory arrangement look like as the value is 0xcdef34?

Will it be

   Base Address+0   34

   Base Address+1   ef

   Base Address+2   cd

 

Question 2:

if the answer of Q1 is right and some document tells me that

offset 0   i/o address

offset 3   i/o value

and I got the memory content as

    Base Address+0   23

    Base Address+1   45

    Base Address+2   ef

    Base Address+3   df

    Base Address+4   02

    Base Address+5   01

 

Does that mean the i/o address is 0xef4523 and i/o value is 0x0102df?

 

Question 3:

If I got a big array which represents a large number like below:

    static unsigned char n[] =

"\x00\xAA\x36\xAB\xCE\x88\xAC\xFD\xFF\x55\x52\x3C\x7F\xC4\x52\x3F"

"\x90\xEF\xA0\x0D\xF3\x77\x4A\x25\x9F\x2E\x62\xB4\xC5\xD9\x9C\xB5"

"\xAD\xB3\x00\xA0\x28\x5E\x53\x01\x93\x0E\x0C\x70\xFB\x68\x76\x93"

"\x9C\xE6\x16\xCE\x62\x4A\x11\xE0\x08\x6D\x34\x1E\xBC\xAC\xA0\xA1"

"\xF5";

 

Should the value be 0xF5A1A0ACBc …….., from 0xn[end] ~ n[0], just like little-endian order, or 0x00AA36AB….F5, just like big-endian order.

Or this value will be different under different machine even it is a c source code.

 

Appreciate your help,

vichy

 

 

 

 

 



[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