Dword x was saved to memory as a series of bytes 123, 29. How much is the value of x in decimal system using little endian?
The answer to this question is 7547
.
Can somebody explain this to me step by step? I already know that little endian reverses the order, but this doesn't give this answer. I tried to do conversion to another system, but it still gives me the wrong answer.
I'd like to give you an alternative explanation to Kasper's answer:
In the decimal system you can "store" values from 0 to 9 in each digit. To store larger numbers, you use multiple digits. The value of a number written as "1234" is calculated like this:
1234 = 4 + 3*10 + 2*10*10 + 1*10*10*10
Using bytes you can store values from 0 to 255 in each digit. Just like in the decimal system, you can store larger values by using multiple bytes:
4, 3, 2, 1 = 4 + 3*256 + 2*256*256 + 1*256*256*256
123, 29 = 123 + 29*256 = 7547
("Little endian" means that the least byte is stored in memory first; just like you would read a decimal number from right to left.)