From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by dpdk.org (Postfix) with ESMTP id 47FA25A9B for ; Mon, 9 Mar 2015 06:38:16 +0100 (CET) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga102.jf.intel.com with ESMTP; 08 Mar 2015 22:36:35 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.11,365,1422950400"; d="scan'208";a="677103815" Received: from pgsmsx103.gar.corp.intel.com ([10.221.44.82]) by fmsmga001.fm.intel.com with ESMTP; 08 Mar 2015 22:38:15 -0700 Received: from shsmsx104.ccr.corp.intel.com (10.239.4.70) by PGSMSX103.gar.corp.intel.com (10.221.44.82) with Microsoft SMTP Server (TLS) id 14.3.195.1; Mon, 9 Mar 2015 13:38:13 +0800 Received: from shsmsx101.ccr.corp.intel.com ([169.254.1.192]) by SHSMSX104.ccr.corp.intel.com ([169.254.5.161]) with mapi id 14.03.0195.001; Mon, 9 Mar 2015 13:38:12 +0800 From: "Wang, Zhihong" To: "dev@dpdk.org" , "Qiu, Michael" Thread-Topic: [PATCH] librte_eal/common: Fix cast from pointer to integer of different size Thread-Index: AQHQV7uAdWhIdw7wH0it59rURqjS/p0TppMw Date: Mon, 9 Mar 2015 05:38:11 +0000 Message-ID: References: <1425541598-8669-1-git-send-email-michael.qiu@intel.com> <1425611587-769-1-git-send-email-michael.qiu@intel.com> In-Reply-To: <1425611587-769-1-git-send-email-michael.qiu@intel.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: Re: [dpdk-dev] [PATCH] librte_eal/common: Fix cast from pointer to integer of different size X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 09 Mar 2015 05:38:17 -0000 > -----Original Message----- > From: Qiu, Michael > Sent: Friday, March 06, 2015 11:13 AM > To: dev@dpdk.org > Cc: Qiu, Michael; Wang, Zhihong > Subject: [PATCH] librte_eal/common: Fix cast from pointer to integer of > different size >=20 > ./i686-native-linuxapp-gcc/include/rte_memcpy.h:592:23: error: > cast from pointer to integer of different size [-Werror=3Dpointer-to-int-= cast] >=20 > dstofss =3D 16 - (int)((long long)(void *)dst & 0x0F) + 16; >=20 > Type 'long long' is 64-bit in i686 platform while 'void *' > is 32-bit. >=20 > Signed-off-by: Michael Qiu > Signed-off-by: Zhihong Wang > --- > v4 --> v3: > fix dstofss/bits to size_t in rte_memcpy() > v3 --> v2: > make dstofss and srcofs to be type size_t > casting type use uintptr_t >=20 > v2 --> v1: > Remove unnecessary casting (void *) >=20 > lib/librte_eal/common/include/arch/x86/rte_memcpy.h | 14 +++++++------- > 1 file changed, 7 insertions(+), 7 deletions(-) >=20 > 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 7b2d382..6ec4434 100644 > --- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h > +++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h > @@ -196,8 +196,8 @@ static inline void * rte_memcpy(void *dst, const voi= d > *src, size_t n) { > void *ret =3D dst; > - int dstofss; > - int bits; > + size_t dstofss; > + size_t bits; >=20 > /** > * Copy less than 16 bytes > @@ -271,7 +271,7 @@ COPY_BLOCK_64_BACK31: > /** > * Make store aligned when copy size exceeds 512 bytes > */ > - dstofss =3D 32 - (int)((long long)(void *)dst & 0x1F); > + dstofss =3D 32 - ((uintptr_t)dst & 0x1F); > n -=3D dstofss; > rte_mov32((uint8_t *)dst, (const uint8_t *)src); > src =3D (const uint8_t *)src + dstofss; > @@ -493,8 +493,8 @@ rte_memcpy(void *dst, const void *src, size_t n) { > __m128i xmm0, xmm1, xmm2, xmm3, xmm4, xmm5, xmm6, xmm7, > xmm8; > void *ret =3D dst; > - int dstofss; > - int srcofs; > + size_t dstofss; > + size_t srcofs; >=20 > /** > * Copy less than 16 bytes > @@ -589,12 +589,12 @@ COPY_BLOCK_64_BACK15: > * unaligned copy functions require up to 15 bytes > * backwards access. > */ > - dstofss =3D 16 - (int)((long long)(void *)dst & 0x0F) + 16; > + dstofss =3D 16 - ((uintptr_t)dst & 0x0F) + 16; > n -=3D dstofss; > rte_mov32((uint8_t *)dst, (const uint8_t *)src); > src =3D (const uint8_t *)src + dstofss; > dst =3D (uint8_t *)dst + dstofss; > - srcofs =3D (int)((long long)(const void *)src & 0x0F); > + srcofs =3D ((uintptr_t)src & 0x0F); >=20 > /** > * For aligned copy > -- > 1.9.3 Acked-by: Wang, Zhihong