Results 1 to 4 of 4

Thread: How to interpret data encoded using little endian ?

  1. #1
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default How to interpret data encoded using little endian ?

    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.

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to interpret data encoded using little endian ?

    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

  3. #3
    Join Date
    Jan 2006
    Posts
    162
    Thanks
    9
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: How to interpret data encoded using little endian ?

    And in case of 16 bits group instead of 32 ?

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: How to interpret data encoded using little endian ?

    Quote Originally Posted by yellowmat
    And in case of 16 bits group instead of 32 ?
    24 58 00 0D
    28 D4 00 10

  5. The following user says thank you to jacek for this useful post:

    yellowmat (26th July 2006)

Similar Threads

  1. speed of setdata - lots of items in treeview
    By Big Duck in forum Qt Programming
    Replies: 4
    Last Post: 6th July 2006, 12:53
  2. How to convert binary data to hexadecimal data
    By yellowmat in forum Newbie
    Replies: 4
    Last Post: 8th March 2006, 16:17
  3. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.