Do not assume int can hold a pointer

On 64-bit, int can't hold a pointer. Use intptr_t which is defined for this purpose.