DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Tang, HaifengX" <haifengx.tang@intel.com>
To: "Qiu, Michael" <michael.qiu@intel.com>, "dev@dpdk.org" <dev@dpdk.org>
Subject: Re: [dpdk-dev] [PATCH v3] librte_eal/common: Fix cast from pointer to	integer of different size
Date: Thu, 5 Mar 2015 08:25:40 +0000	[thread overview]
Message-ID: <DF029FFF923C334FAA58CEEB2979DCA6014F8CEE@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1425541598-8669-1-git-send-email-michael.qiu@intel.com>

Tested-by: haifeng.tang <haifengx.tang@intel.com>
Patch name: [dpdk-dev] [PATCH v3] librte_eal/common: Fix cast from pointer to integer of different size

Test Env :
Fedora 18 , 3.6.10-4 ,4.7.2 ,14.0.0

Fedora20 ,3.11.0,4.8.2,14.0.0

Fedora21,3.17.4-302,4.9.2,15.0.0

Ubuntu 14.04, 3.13.0-30, 4.8.2, 14.0.0

Test Result:
error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] problem fixed now

-----Original Message-----
From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Michael Qiu
Sent: Thursday, March 05, 2015 3:47 PM
To: dev@dpdk.org
Subject: [dpdk-dev] [PATCH v3] librte_eal/common: Fix cast from pointer to integer of different size

./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 <michael.qiu@intel.com>
---
v3 --> v2:
	make dstofss and srcofs to be type size_t
	casting type use uintptr_t

v2 --> v1:
	Remove unnecessary casting (void *)
 lib/librte_eal/common/include/arch/x86/rte_memcpy.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 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 7b2d382..aa433e4 100644
--- a/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
+++ b/lib/librte_eal/common/include/arch/x86/rte_memcpy.h
@@ -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 = dst;
-	int dstofss;
-	int srcofs;
+	size_t dstofss;
+	size_t srcofs;
 
 	/**
 	 * Copy less than 16 bytes
@@ -589,12 +589,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
--
1.9.3

  reply	other threads:[~2015-03-05  8:25 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-02  7:27 [dpdk-dev] [PATCH] " Michael Qiu
2015-03-02 11:39 ` Gonzalez Monroy, Sergio
2015-03-03  2:02   ` Qiu, Michael
2015-03-03  2:20 ` [dpdk-dev] [PATCH v2] " Michael Qiu
2015-03-03  8:25   ` Pawel Wodkowski
2015-03-03  9:59     ` Qiu, Michael
2015-03-03 13:37       ` Pawel Wodkowski
2015-03-04  1:58         ` Qiu, Michael
2015-03-04  8:18           ` Pawel Wodkowski
2015-03-04 11:24             ` Qiu, Michael
2015-03-05  7:46 ` [dpdk-dev] [PATCH v3] " Michael Qiu
2015-03-05  8:25   ` Tang, HaifengX [this message]
2015-03-06  3:13   ` [dpdk-dev] [PATCH] " Michael Qiu
2015-03-09  5:38     ` Wang, Zhihong
2015-03-09 11:43       ` Thomas Monjalon
2015-03-05  9:21 [dpdk-dev] [PATCH v3] " Tang, HaifengX
2015-03-05  9:58 ` Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=DF029FFF923C334FAA58CEEB2979DCA6014F8CEE@SHSMSX103.ccr.corp.intel.com \
    --to=haifengx.tang@intel.com \
    --cc=dev@dpdk.org \
    --cc=michael.qiu@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).