The type you’re looking for is usize. Instead of GRAINS_UINTPTR you can just use usize, which is a pointer-sized integer.
The size of this primitive (usize) is how many bytes it takes to reference any location in memory. For example, on a 32 bit target, this is 4 bytes and on a 64 bit target, this is 8 bytes.
(There has been a lot of discussion over whether usize is size_t or uintptr_t that hasn’t really been resolved yet. AFAICT the “more correct” usage is usize = uintptr_t, but since it has “size” in the name and is also used for indexing, people also assume usize = size_t (and on mainstream platforms, uintptr_t = size_t)).