mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2024-11-09 12:48:43 +00:00
Changed IPv4 hash function to simple multiplication.
This commit is contained in:
parent
14375237f6
commit
84661bf6da
8
lib/ip.h
8
lib/ip.h
@ -186,13 +186,7 @@ static inline int ipa_nonzero2(ip_addr a)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static inline u32 ip4_hash(ip4_addr a)
|
static inline u32 ip4_hash(ip4_addr a)
|
||||||
{
|
{ return u32_hash(_I(a)); }
|
||||||
/* Returns a 32-bit value, although low-order bits are not mixed */
|
|
||||||
u32 x = _I(a);
|
|
||||||
x ^= x << 16;
|
|
||||||
x ^= x << 12;
|
|
||||||
return x;
|
|
||||||
}
|
|
||||||
|
|
||||||
static inline u32 ip6_hash(ip6_addr a)
|
static inline u32 ip6_hash(ip6_addr a)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user