Use np.uintp_t for offset calculation. 

Pointers should not be casted to a signed integer. np.uintp_t is an alias for npy_uintp, typedefed to Py_uintptr_t in NumPy npy_common.h.