Software and Programming Reference / Items
Understanding Big and Little Endian Byte Order | BetterExplained
Get Feed- Description
-
Understanding Big and Little Endian Byte Order
Problems with byte order are frustrating, and I want to spare you the grief I experienced. Here's the key:
Problem: Computers speak different languages, like people.
Some write data "left-to-right" and others "right-to-left".
A machine can read its own data just fine - problems happen when one computer stores data and a different type tries to read it.
Solutions Agree to a common format (i.e., all network traffic follows a single format), or Always include a header that describes the format of the data. If the header appears backwards, it means data was stored in the other format and needs to be converted.
Numbers vs. Data
The most important concept is to recognize the difference between a number and the data that represents it. number is an abstract concept, such as a count of something. You have ten fingers. The idea of "ten" doesn't change, no matter what representation you use: ten, 10, diez (Spanish), ju (Japanese), 1010 (binary), X (Roman numeral)... these representations all point to the same concept of "ten".
Contrast this with data. Data is a physical concept, a raw sequence of bits and bytes stored on a computer. Data has no inherent meaning and must be interpreted by whoever is reading it.
Data is like human writing, which is simply marks on paper. There is no inherent meaning in these marks. If we see a line and a circle (like this: |O) we may interpret it to mean "ten".
But we assumed the marks referred to a number. They could have been the letters "IO", a moon of Jupiter. Or perhaps the Greek goddess. Or maybe an abbreviation for Input/Output. Or someone's initials. Or 10 in base 2, aka 2 in binary. The list of possibilities goes on.
The point is ...
- Original URL
Comments
Report ThisTwine is about discovering, collecting and sharing the content that interests you. Learn More
Join TwineStats
- 1 Twine
- Make a comment
Tags
Community Tags
Who's Interested In This?
-
Calvin Smith added to Software and Programming Reference 11 months ago
Public Comments
Add a Comment