1

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) ?

Lundin
  • 195,001
  • 40
  • 254
  • 396
backlash
  • 777
  • 1
  • 6
  • 12

1 Answers1

2

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
Lundin
  • 195,001
  • 40
  • 254
  • 396