Comparing the ordering of two pointers doesn’t make sense except when both pointers point into the same array (and even then it’s questionable at best; generally you’d use inequality instead of ordering).
Since your actual problem is
my signal's address higher bytes is getting overwritten by 0XFFFE0
The first order of business is to find out why this is happening and whether it can be prevented: If an address gets overridden this indicates that there’s something very wrong with the code, and that you should fix the root cause rather than the symptoms.
That said, if all that’s required is to zero out the higher, overridden bytes of your pointer, the portable way is to convert the pointer to an integer and manipulate that, rather than manipulating the pointer directly:
const uintptr_t mask_bytes = 0xFFFE;
const int mask_width = 4 * CHAR_BIT; // ?!
const uintptr_t mask = mask_bytes << ((sizeof(uintptr_t) * CHAR_BIT) - mask_width);
uintptr_t uaddr = (uintptr_t) addr;
if ((uaddr & mask) == mask) {
addr = (void*) (uaddr & ~ mask);
}
… substitute void*
with your actual pointer type.