In: Computer Science
Given byte-addressed memory with location 0x100 containing 0x62 and location 0x101 containing 0x7C. What is the decimal value of the signed short stored at location 0x100:
Assuming big-endian addressing.
Assuming little-endian addressing.
You may assume that a short occupies 2 bytes.

a)
big-endian
hex value is 0x627C
Hexadecimal Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111
Use this table to convert from hexadecimal to binary
Converting 627C to binary
6 => 0110
2 => 0010
7 => 0111
C => 1100
So, in binary 627C is 0110001001111100
Now converting 0x627C to decimal
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
Converting 110001001111100 to decimal
110001001111100
=> 1x2^14+1x2^13+0x2^12+0x2^11+0x2^10+1x2^9+0x2^8+0x2^7+1x2^6+1x2^5+1x2^4+1x2^3+1x2^2+0x2^1+0x2^0
=> 1x16384+1x8192+0x4096+0x2048+0x1024+1x512+0x256+0x128+1x64+1x32+1x16+1x8+1x4+0x2+0x1
=> 16384+8192+0+0+0+512+0+0+64+32+16+8+4+0+0
=> 25212
Answer: 25212
b)
little-endian
hex value is 0x7C62
Hexadecimal Binary
0 0000
1 0001
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
A 1010
B 1011
C 1100
D 1101
E 1110
F 1111
Use this table to convert from hexadecimal to binary
Converting 7C62 to binary
7 => 0111
C => 1100
6 => 0110
2 => 0010
So, in binary 7C62 is 0111110001100010
Now converting 0x7C62 to decimal
since left most bit is 0, this number is positive
so, we can directly convert this into a decimal value
Converting 111110001100010 to decimal
111110001100010
=> 1x2^14+1x2^13+1x2^12+1x2^11+1x2^10+0x2^9+0x2^8+0x2^7+1x2^6+1x2^5+0x2^4+0x2^3+0x2^2+1x2^1+0x2^0
=> 1x16384+1x8192+1x4096+1x2048+1x1024+0x512+0x256+0x128+1x64+1x32+0x16+0x8+0x4+1x2+0x1
=> 16384+8192+4096+2048+1024+0+0+0+64+32+0+0+0+2+0
=> 31842
Answer: 31842