Thread (8 messages) flat view 8 messages, 3 authors, 2012-08-03

Re: [PATCH] ipv4: remove parentheses in return statement

From: David Miller <davem@davemloft.net>
Date: 2012-08-03 09:22:41

From: Eric Dumazet <redacted>
Date: Fri, 03 Aug 2012 11:19:44 +0200
On Fri, 2012-08-03 at 01:43 -0600, Jean Sacren wrote:
quoted
@@ -106,8 +106,8 @@ static inline unsigned int inet_addr_hash(struct net *net, __be32 addr)
 {
 	u32 val = (__force u32) addr ^ hash_ptr(net, 8);
 
-	return ((val ^ (val >> 8) ^ (val >> 16) ^ (val >> 24)) &
-		(IN4_ADDR_HSIZE - 1));
+	return (val ^ (val >> 8) ^ (val >> 16) ^ (val >> 24)) &
+	       (IN4_ADDR_HSIZE - 1);
 }
BTW This should use a faster implementation, I'll send a patch when
net-next is opened.
There seems to be a few spots where we want the pointer "as a 32-bit
integer" for hashing.  We were discussing arp_hashfn() and ndisc_hashfn()
the other day.

It should basically do something like:

	(u32) ((u64)ptr >> 32 | ((u32) ptr))

on 64-bit and simply (u32)(ptr) on 32-bit.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help