From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by dpdk.org (Postfix) with ESMTP id 0D442568F for ; Tue, 3 Mar 2015 10:59:42 +0100 (CET) Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmsmga103.fm.intel.com with ESMTP; 03 Mar 2015 01:54:47 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.09,681,1418112000"; d="scan'208";a="535321442" Received: from pgsmsx104.gar.corp.intel.com ([10.221.44.91]) by orsmga003.jf.intel.com with ESMTP; 03 Mar 2015 01:59:41 -0800 Received: from kmsmsx154.gar.corp.intel.com (172.21.73.14) by PGSMSX104.gar.corp.intel.com (10.221.44.91) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 3 Mar 2015 17:59:39 +0800 Received: from shsmsx104.ccr.corp.intel.com (10.239.110.15) by KMSMSX154.gar.corp.intel.com (172.21.73.14) with Microsoft SMTP Server (TLS) id 14.3.195.1; Tue, 3 Mar 2015 17:59:38 +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; Tue, 3 Mar 2015 17:59:37 +0800 From: "Qiu, Michael" To: "Wodkowski, PawelX" , "dev@dpdk.org" Thread-Topic: [dpdk-dev] [PATCH v2] librte_eal/common: Fix cast from pointer to integer of different size Thread-Index: AQHQVVixjCQ23eswG0KNXZTQD6fASA== Date: Tue, 3 Mar 2015 09:59:36 +0000 Message-ID: <533710CFB86FA344BFBF2D6802E60286CED932@SHSMSX101.ccr.corp.intel.com> References: <1425281223-14043-1-git-send-email-michael.qiu@intel.com> <1425349251-15663-1-git-send-email-michael.qiu@intel.com> <54F56FEB.5050803@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 v2] 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: Tue, 03 Mar 2015 09:59:43 -0000 On 3/3/2015 4:25 PM, Wodkowski, PawelX wrote:=0A= > On 2015-03-03 03:20, Michael Qiu wrote:=0A= >> /i686-native-linuxapp-gcc/include/rte_memcpy.h:592:23: error:=0A= >> cast from pointer to integer of different size=0A= >> [-Werror=3Dpointer-to-int-cast]=0A= >>=0A= >> dstofss =3D 16 - (int)((long long)(void *)dst & 0x0F) + 16;=0A= >>=0A= >> Type 'long long' is 64-bit in i686 platform while 'void *'=0A= >> is 32-bit.=0A= >>=0A= >> Signed-off-by: Michael Qiu =0A= >> ---=0A= >> v2 --> v1:=0A= >> Remove unnecessary casting (void *)=0A= >>=0A= >> lib/librte_eal/common/include/arch/x86/rte_memcpy.h | 4 ++--=0A= >> 1 file changed, 2 insertions(+), 2 deletions(-)=0A= >>=0A= >> diff --git a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h b/lib/l= ibrte_eal/common/include/arch/x86/rte_memcpy.h=0A= >> index 7b2d382..85a5f4d 100644=0A= >> --- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h=0A= >> +++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h=0A= >> @@ -589,12 +589,12 @@ COPY_BLOCK_64_BACK15:=0A= >> * unaligned copy functions require up to 15 bytes=0A= >> * backwards access.=0A= >> */=0A= >> - dstofss =3D 16 - (int)((long long)(void *)dst & 0x0F) + 16;=0A= >> + dstofss =3D 16 - (int)((long)dst & 0x0F) + 16;=0A= >> n -=3D dstofss;=0A= >> rte_mov32((uint8_t *)dst, (const uint8_t *)src);=0A= >> src =3D (const uint8_t *)src + dstofss;=0A= >> dst =3D (uint8_t *)dst + dstofss;=0A= >> - srcofs =3D (int)((long long)(const void *)src & 0x0F);=0A= >> + srcofs =3D (int)((long)src & 0x0F);=0A= >>=0A= >> /**=0A= >> * For aligned copy=0A= >>=0A= > I think you should use here size_t, (u)ptrdiff_t or (u)intptr_t as this = =0A= =0A= Yes, but 'long' is enough, does it limit anything, or has any issue with=0A= multiple platforms?=0A= =0A= > will be more portable.=0A= > Also type of dstofss and srcofs should be changed accordingly.=0A= =0A= No, I think, it should be offset.=0A= =0A= Thanks,=0A= Michael=0A= >=0A= =0A=