fix: convert ptr to int via intptr_t
fix: stdint.h is needed on some systems for intptr_t