From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tony Lu Subject: Re: [PATCH v3 02/12] hash: fix compilation on non-X86 platforms Date: Wed, 8 Jul 2015 16:21:27 +0800 Message-ID: <001501d0b957$2072eb80$6158c280$@com> References: <1436172698-21749-1-git-send-email-zlu@ezchip.com> <1436172698-21749-3-git-send-email-zlu@ezchip.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: "'Sanford, Robert'" , Return-path: Received: from emea01-db3-obe.outbound.protection.outlook.com (mail-db3on0091.outbound.protection.outlook.com [157.55.234.91]) by dpdk.org (Postfix) with ESMTP id 8E83E11C5 for ; Wed, 8 Jul 2015 10:22:01 +0200 (CEST) In-Reply-To: Content-Language: zh-cn List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" >-----Original Message----- >From: Sanford, Robert [mailto:rsanford@akamai.com] >Sent: Tuesday, July 07, 2015 10:52 PM >To: Zhigang Lu; dev@dpdk.org >Subject: Re: [dpdk-dev] [PATCH v3 02/12] hash: fix compilation on non-X86 >platforms > >Hi Zhigang, > >Can you add this one-line X86 change (below)? When included by C++ code, 'key' >needs an explicit type cast. OK, will add this in next version. >You may want to put the 'const' keyword in your non-X86 change, too. >-- > >Thanks, >Robert > > > > >diff --git a/lib/librte_hash/rte_jhash.h b/lib/librte_hash/rte_jhash.h index >e230449..49b4ac0 100644 >--- a/lib/librte_hash/rte_jhash.h >+++ b/lib/librte_hash/rte_jhash.h >@@ -119,7 +119,7 @@ __rte_jhash_2hashes(const void *key, uint32_t length, >uint32_t *pc, > * If check_align is not set, first case will be used > */ > #if defined(RTE_ARCH_X86_64) || defined(RTE_ARCH_I686) || >defined(RTE_ARCH_X86_X32) >- const uint32_t *k = key; >+ const uint32_t *k = (const uint32_t *)key; > const uint32_t s = 0; > #else > const uint32_t *k = (uint32_t *)(uintptr_t)key & (uintptr_t)~3); >-- > > > > > > >>The "hash: remove duplicated code" change unfortunately broke the build >>for non-X86 platforms. This patch fixes this breakage. >> >>Change-Id: Ie109d67e681b75b45320fab1bf9de4eb9c9701bf >>Signed-off-by: Zhigang Lu >>--- >> lib/librte_hash/rte_jhash.h | 3 ++- >> 1 file changed, 2 insertions(+), 1 deletion(-) >> >>diff --git a/lib/librte_hash/rte_jhash.h b/lib/librte_hash/rte_jhash.h >>index e230449..d1b6cf3 100644 >>--- a/lib/librte_hash/rte_jhash.h >>+++ b/lib/librte_hash/rte_jhash.h >>@@ -44,6 +44,7 @@ >> extern "C" { >> #endif >> >>+#include >> #include >> #include >> >>@@ -122,7 +123,7 @@ __rte_jhash_2hashes(const void *key, uint32_t >>length, uint32_t *pc, >> const uint32_t *k = key; >> const uint32_t s = 0; >> #else >>- const uint32_t *k = (uint32_t *)(uintptr_t)key & (uintptr_t)~3); >>+ const uint32_t *k = (uint32_t *)((uintptr_t)key & (uintptr_t)~3); >> const uint32_t s = ((uintptr_t)key & 3) * CHAR_BIT; #endif >> if (!check_align || s == 0) { >>-- >>2.1.2 >>