backlash
backlash

Reputation: 797

Address of 32 bits integer in Modula-2 on a Big Endian architecture

I have this line of code in modula-2 on a Big Endian processor :

Ptr := ADR(My_32_Bits_Integer)

I want to know if Ptr will be equal to the adress of the most significant byte (so the littlest address) or the less significant byte (so the biggest address) ?

Upvotes: 1

Views: 69

Answers (1)

Lundin
Lundin

Reputation: 214310

The address of a 32 bit number is always that of the byte allocated first. On Big Endian systems, this is the MS byte, on Little Endian it is the LS byte.

Given the 32-bit integer 12345678h, then it will be stored like this:

Big Endian:

Offset   Data 
0        12
1        34
2        56
3        78

Little Endian:

Offset   Data 
0        78
1        56
2        34
3        12

Upvotes: 2

Related Questions