convert 32-bit words to big endian

0

I don't understand this question:

Consider a system that has a byte-addressable memory organized in 32-bit words according to the big-endian scheme. A program reads 2 integers into an array and stores them in successive locations, starting at location at address 0x00001000. The 2 integers are 1025 and 287,454,020.

Show the contents of the two memory words at locations 0x00001000 and 0x00001004 after the two integers have been stored.

Can anyone explain how to do this? This is like a new language to me.

hex
asked on Stack Overflow Feb 4, 2014 by Mark

1 Answer

2

Big endian just means that the bytes are ordered from most significant to least significant at increasing memory addresses, so:

0x00001000  00 04 00 01     ; 1024 (decimal)      = 00040001 (hex)
0x00001004  11 22 33 44     ; 287454020 (decimal) = 11223344 (hex)

Just for completeness, if this were a little endian system then memory would look like this:

0x00001000  01 00 04 00     ; 1024 (decimal)      = 00040001 (hex)
0x00001004  44 33 22 11     ; 287454020 (decimal) = 11223344 (hex)
answered on Stack Overflow Feb 4, 2014 by Paul R

User contributions licensed under CC BY-SA 3.0