     }
 }
 
-__device__ long rk_poisson_mult(rk_state *state, double lam) {
-    long X;
+__device__ int64_t rk_poisson_mult(rk_state *state, double lam) {
+    int64_t X;
     double prod, U, enlam;
     enlam = exp(-lam);
     X = 0;


struct poisson_functor {
    template<typename... Args>
    __device__ double operator () (Args&&... args) {
        return rk_poisson(args...);
    }
};

    }
}

__device__ int64_t rk_poisson_ptrs(rk_state *state, double lam) {
    int64_t k;
    double U, V, slam, loglam, a, b, invalpha, vr, us;
    slam = sqrt(lam);
    loglam = log(lam);
