Could you explain me the following convertion:
The address range is 0x00100000 to 0x1fffffff
How to convert it to bytes or Mb?
Engineering Stack Exchange is a question and answer site for professionals and students of engineering. It only takes a minute to sign up.
Sign up to join this communityRemember that the following number 0x123
is essentially (Starting from the last digit)
$$3*16^0 + 2*16^1 + 1*16^2 = 3 + 2*16 + 1*256 =291 $$
it is essentially the same what you are doing if you had 123 in the decimal system (just the base changes):
$$3*10^0 + 2*10^1 + 1*10^2 = 3 + 2*10 + 1*100 =123 $$
So in your case, the first number is
0x00100000
= 1*16^5 = 1048756regarding the second number I'd cheat a little bit, so 0x1fffffff = 0x20000000 -1
. So with that:
0x1fffffff - 0x20000000 -1
= 2*16^7 - 1 = 536870912-1 =536870911Since, each memory address holds a byte, then you'd be talking about a memory address from the 1st MB up to (just before) 512MB (given the convention that 1MB = 1048756 bytes)
\begin{array}{cc} & 0x &\ 1 &\ F &\ F &\ F &\ F &\ F &\ F &\ F \\ - &0x &\ 0 &\ 0 &\ 1 &\ 0 &\ 0 &\ 0 &\ 0 &\ 0 \\ + &0x &\ 0 &\ 0 &\ 0 &\ 0 &\ 0 &\ 0 &\ 0 &\ 1 \\ = &0x &\ 1 &\ F &\ F &\ 0 &\ 0 &\ 0 &\ 0 &\ 0 \\ \times & &\ 16^7 &\ 16^6 &\ 16^5 &\ 16^4 &\ 16^3 &\ 16^2 &\ 16^1 &\ 16^0 \\ \end{array}
Adding 1 goes from start to end.
$$1 \times 16^7 + 15 \times 16^6 + 15 \times 16^5 = 535,822,336\ bytes$$
0x100000 = 1MB = 1,048,576 bytes, so the address range from 0x00100000 to 0x1fffffff is 511MB.