From mboxrd@z Thu Jan 1 00:00:00 1970 From: "Sanford, Robert" Subject: Re: [PATCH v3 02/12] hash: fix compilation on non-X86 platforms Date: Tue, 7 Jul 2015 14:52:11 +0000 Message-ID: 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: quoted-printable To: Zhigang Lu , "dev@dpdk.org" Return-path: Received: from prod-mail-xrelay08.akamai.com (prod-mail-xrelay08.akamai.com [96.6.114.112]) by dpdk.org (Postfix) with ESMTP id 487C7595E for ; Tue, 7 Jul 2015 16:52:14 +0200 (CEST) In-Reply-To: <1436172698-21749-3-git-send-email-zlu@ezchip.com> Content-Language: en-US Content-ID: <4D8D26B691DCDE49A662F1BE39C7D9EC@akamai.com> 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" Hi Zhigang, Can you add this one-line X86 change (below)? When included by C++ code, 'key' needs an explicit type cast. 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 =3D key; + const uint32_t *k =3D (const uint32_t *)key; const uint32_t s =3D 0; #else const uint32_t *k =3D (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 >=20 >+#include > #include > #include >=20 >@@ -122,7 +123,7 @@ __rte_jhash_2hashes(const void *key, uint32_t length, >uint32_t *pc, > const uint32_t *k =3D key; > const uint32_t s =3D 0; > #else >- const uint32_t *k =3D (uint32_t *)(uintptr_t)key & (uintptr_t)~3); >+ const uint32_t *k =3D (uint32_t *)((uintptr_t)key & (uintptr_t)~3); > const uint32_t s =3D ((uintptr_t)key & 3) * CHAR_BIT; > #endif > if (!check_align || s =3D=3D 0) { >--=20 >2.1.2 >