Type casts from pointers to unsigned long don't work on 64 bit Windows
because both types have different size.

Compiler warning:

include/standard-headers/linux/virtio_ring.h:146:23:
 warning: cast from pointer to integer of different size
 [-Wpointer-to-int-cast]
  vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + ...
                       ^

Signed-off-by: Stefan Weil <s...@weilnetz.de>
---

This is a modification of a Linux header file,
something we usually try to avoid.

I did not succeed in removing this header from compilations
for Windows (which would have been the best solution).

Nor do I expect that Linux would accept a patch which
modifies code to better support compilations for Windows.

Are there other possibilities how this could be handled?

Regards
Stefan

 include/standard-headers/linux/virtio_ring.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/include/standard-headers/linux/virtio_ring.h 
b/include/standard-headers/linux/virtio_ring.h
index 6fe276f..3d531f7 100644
--- a/include/standard-headers/linux/virtio_ring.h
+++ b/include/standard-headers/linux/virtio_ring.h
@@ -143,7 +143,7 @@ static inline void vring_init(struct vring *vr, unsigned 
int num, void *p,
        vr->num = num;
        vr->desc = p;
        vr->avail = p + num*sizeof(struct vring_desc);
-       vr->used = (void *)(((unsigned long)&vr->avail->ring[num] + 
sizeof(__virtio16)
+       vr->used = (void *)(((uintptr_t)&vr->avail->ring[num] + 
sizeof(__virtio16)
                + align-1) & ~(align - 1));
 }
 
-- 
2.1.4


Reply via email to