Subject: Re: [PATCH] improvement on net/sched/cls_fw.c's hash function

From: Wang Jian <[email-masked]>
Date: Wed, 06 Apr 2005 21:53:55 +0800

Hi Eran Mann,

On Wed, 06 Apr 2005 16:36:20 +0300, [email-masked] (Eran Mann) wrote:

> 
> Maybe you could add to the list of options a XOR of bytes hash, 
> something like:
> static inline u8 bytes_xor_u32( u32 key )
> {
> 	u8 *dummy_array = (u8 *)&key;
> 	u8 hash = dummy_array[0] ^ dummy_array[1] ^
> 		  dummy_array[2] ^ dummy_array[3];
> 
> 	return hash;
> }
> 

Ha, then this hi-or-lo word hash, which assumes that high or low word is
0, and key is distributed in the old fashion (0..255, etc)

static inline u32 hi_or_lo_hash(u32 key)
{
	return (key >> 16 ^ key) & 0xFF;
}

-- 
  lark