PDA

View Full Version : How to interpret data encoded using little endian ?



yellowmat
26th July 2006, 13:06
Hi everybody,

I have some datas that I must interpret and they are encoded in little endian. The problem is that I'm not sure I interpret them the right way. My datas are expressed in hexadecimal format and I need to express them in decimal format but if I make an interpretation error my application will not work well so I hope soemone could help me.

Here is an example of my datas :
58 24 0D 00 (encoded using little endian)

D4 28 10 00 (encoded using little endian)

Takine the two following examples, how must I read the data to find the good decimal value ?

Should I interpret 58 24 0D 00 as 00 D0 42 85 or is it something else ? Same question for the second example.

Thanks in advance.

jacek
26th July 2006, 13:12
It should be 00 0D 24 58 and 00 10 28 D4 (provided that those were 32-bit words) --- you must change the order of whole bytes.

http://en.wikipedia.org/wiki/Endianness

yellowmat
26th July 2006, 13:17
And in case of 16 bits group instead of 32 ?

jacek
26th July 2006, 13:41
And in case of 16 bits group instead of 32 ?
24 58 00 0D
28 D4 00 10