[dpdk-dev,v3,02/12] hash: fix compilation on non-X86 platforms

Message ID 1436172698-21749-3-git-send-email-zlu@ezchip.com (mailing list archive)
State Changes Requested, archived
Headers

Commit Message

Zhigang Lu July 6, 2015, 8:51 a.m. UTC
  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 <zlu@ezchip.com>
---
 lib/librte_hash/rte_jhash.h | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Bruce Richardson July 6, 2015, 11:15 a.m. UTC | #1
On Mon, Jul 06, 2015 at 04:51:27PM +0800, Zhigang Lu wrote:
> The "hash: remove duplicated code" change unfortunately broke the
> build for non-X86 platforms.  This patch fixes this breakage.
> 
Fixes: 49361c3f3cfa ("hash: remove duplicated code")

> Change-Id: Ie109d67e681b75b45320fab1bf9de4eb9c9701bf
> Signed-off-by: Zhigang Lu <zlu@ezchip.com>

Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  
Zhigang Lu July 7, 2015, 8:24 a.m. UTC | #2
>-----Original Message-----
>From: Bruce Richardson [mailto:bruce.richardson@intel.com]
>Sent: Monday, July 06, 2015 7:15 PM
>To: Zhigang Lu
>Cc: dev@dpdk.org
>Subject: Re: [dpdk-dev] [PATCH v3 02/12] hash: fix compilation on non-X86
>platforms
>
>On Mon, Jul 06, 2015 at 04:51:27PM +0800, Zhigang Lu wrote:
>> The "hash: remove duplicated code" change unfortunately broke the
>> build for non-X86 platforms.  This patch fixes this breakage.
>>
>Fixes: 49361c3f3cfa ("hash: remove duplicated code")

Will add this commit id. Thanks.

>> Change-Id: Ie109d67e681b75b45320fab1bf9de4eb9c9701bf
>> Signed-off-by: Zhigang Lu <zlu@ezchip.com>
>
>Acked-by: Bruce Richardson <bruce.richardson@intel.com>
  

Patch

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 <limits.h>
 #include <stdint.h>
 #include <string.h>
 
@@ -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) {