p = (void *)(uintptr_t)(((uintptr_t)iter->map & TARGET_PAGE_MASK) | off_in_page);
Which looks kind of ugly but then the code is taking a host void* (iter->map), casting it to integer to do arithmetic on and then wanting to get it back to a void* which is inherently going to result in a mess of casting...
I suspect an extra uintptr_t cast will fix this:
p = (void *)(uintptr_ t)(((uintptr_ t)iter- >map & TARGET_PAGE_MASK) | off_in_page);
Which looks kind of ugly but then the code is taking a host void* (iter->map), casting it to integer to do arithmetic on and then wanting to get it back to a void* which is inherently going to result in a mess of casting...