From 7eb689794a219838472dc7c20604732b53b3c7e8 Mon Sep 17 00:00:00 2001 From: Michael Qiu Date: Fri, 6 Mar 2015 11:13:07 +0800 Subject: [PATCH] eal/x86: fix integer cast in memcpy ./i686-native-linuxapp-gcc/include/rte_memcpy.h:592:23: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] dstofss = 16 - (int)((long long)(void *)dst & 0x0F) + 16; Type 'long long' is 64-bit in i686 platform while 'void *' is 32-bit. Signed-off-by: Michael Qiu Signed-off-by: Zhihong Wang --- .../common/include/arch/x86/rte_memcpy.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h index 0a9e3a8875..ac720696cc 100644 --- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h +++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h @@ -198,8 +198,8 @@ rte_memcpy(void *dst, const void *src, size_t n) uintptr_t dstu = (uintptr_t)dst; uintptr_t srcu = (uintptr_t)src; void *ret = dst; - int dstofss; - int bits; + size_t dstofss; + size_t bits; /** * Copy less than 16 bytes @@ -273,7 +273,7 @@ COPY_BLOCK_64_BACK31: /** * Make store aligned when copy size exceeds 512 bytes */ - dstofss = 32 - (int)((long long)(void *)dst & 0x1F); + dstofss = 32 - ((uintptr_t)dst & 0x1F); n -= dstofss; rte_mov32((uint8_t *)dst, (const uint8_t *)src); src = (const uint8_t *)src + dstofss; @@ -497,8 +497,8 @@ rte_memcpy(void *dst, const void *src, size_t n) uintptr_t dstu = (uintptr_t)dst; uintptr_t srcu = (uintptr_t)src; void *ret = dst; - int dstofss; - int srcofs; + size_t dstofss; + size_t srcofs; /** * Copy less than 16 bytes @@ -593,12 +593,12 @@ COPY_BLOCK_64_BACK15: * unaligned copy functions require up to 15 bytes * backwards access. */ - dstofss = 16 - (int)((long long)(void *)dst & 0x0F) + 16; + dstofss = 16 - ((uintptr_t)dst & 0x0F) + 16; n -= dstofss; rte_mov32((uint8_t *)dst, (const uint8_t *)src); src = (const uint8_t *)src + dstofss; dst = (uint8_t *)dst + dstofss; - srcofs = (int)((long long)(const void *)src & 0x0F); + srcofs = ((uintptr_t)src & 0x0F); /** * For aligned copy -- 2.20.1