Fix build under g++.

g++ requires stdint.h (or cstdint in C++11) for [u]intptr_t to be available, and won't compile a cast from a pointer to a differently-sized type.