Why is the high portion of the physical address structure defined as a signed type?

I see that the structure of some physical addresses is defined as follows:

typedef union {
   struct {
       ULONG LowPart;
       LONG HighPart;
   } u;
   LONGLONG QuadPart;
} PHYSICAL_ADDRESS;

I don’t understand why the high part is defined as a signed type ... Can someone give an explanation?

+5
source share
1 answer

A number that is signed to do the math on this makes more sense. If you subtract address 123 from 456, you expect to get address 333, right? So, if you subtract 456 from 123, you expect to get -333, not 18,446,744,073,709,551,283, right? That's why the addresses are signed.

The reason why only the high part is enclosed is because the number has only one bit sign and always the oldest (most significant) bit.

+5
source

All Articles