Since integers and pointers are the same size in the ILP32 compilation environment, some code relies on this assumption. Pointers are often cast to int or unsigned int for address arithmetic. Instead, cast your pointers to long because long and pointers are the same size in both ILP32 and LP64 data-type models. Rather than explicitly using unsigned long, use uintptr_t instead because it expresses your intent more closely and makes the code more portable, insulating it against future changes. Consider the following example:
char *p; p = (char *) ((int)p & PAGEOFFSET); % warning: conversion of pointer loses bits
char *p; p = (char *) ((uintptr_t)p & PAGEOFFSET);