Shop OBEX P1 Docs P2 Docs Learn Events
Why does WRLONG arrange data like this? - Page 3 — Parallax Forums

Why does WRLONG arrange data like this?

13»

Comments

  • Heater,

    You're missing my point. What is your thought process when reading the number 375,600,987,463 aloud? Here's what you have to go through:

    1. Scan 3-7-5. Okay that's three digits, so it's "three hundred seventy-five."

    2. But three hundred seventy-five what? Scan ahead to the end of the number to see how many digits (or, with commas, clusters of digits) there are. Conclude and say "billion."

    3. The rest is easy, since you know the next group is millions, so "six hundred million," and so forth.

    So, yes, you do need to scan twice: once to get the overall magnitude, then again to read out the number.

    Reading from right-to-left, you can build up the overall magnitude as you go along. 'No need for a pre-scan.

    -Phil
  • I think it's software and design, because however the endian format is managed, users need to work easily with the outcome.

    Better presentation, education, design, etc... can all help with that.

  • Heater.Heater. Posts: 21,230
    It's not just a perception problem. It's a question of do things work or not when you get the endianness mixed up.

    For example in C you can write:
        unsigned int x = 0x00010203;
        unsigned char y = *(unsigned char*)&x;
    
    What is the value of y after doing that?

    Well, it depends on the endianness of the machine you run it on.

    A contrived example perhaps, but code like that has existed for decades, usually when packing and unpacking messages and so on.

    It's not just C, the same issue shows up in Spin.

    Then there is that whole thing about byte ordering of data flowing over networks.
Sign In or Register to comment.