diff options
author | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2015-12-24 15:52:03 +0100 |
---|---|---|
committer | Ondrej Zajicek (work) <santiago@crfreenet.org> | 2015-12-24 15:56:04 +0100 |
commit | 04632fd77f291f67753341d12d540f7dac341bd3 (patch) | |
tree | 94b319a0fe0e312539857e76e0b9d6982ce81555 /lib/ip.h | |
parent | 70b90dde23a684c4d32aa53685f76a73ecba941d (diff) |
Follow-up work on integration
Diffstat (limited to 'lib/ip.h')
-rw-r--r-- | lib/ip.h | 24 |
1 files changed, 5 insertions, 19 deletions
@@ -91,6 +91,9 @@ typedef ip6_addr ip_addr; #define ipa_is_ip4(a) ip6_is_v4mapped(a) +#define IPA_NONE4 ipa_from_ip4(IP4_NONE) +#define IPA_NONE6 ipa_from_ip6(IP6_NONE) + /* * Public constructors @@ -180,16 +183,7 @@ static inline int ipa_nonzero2(ip_addr a) * Hash and compare functions */ -static inline uint ip4_hash(ip4_addr a) -{ - /* Returns a 16-bit value */ - u32 x = _I(a); - x ^= x >> 16; - x ^= x << 10; - return x & 0xffff; -} - -static inline u32 ip4_hash32(ip4_addr a) +static inline u32 ip4_hash(ip4_addr a) { /* Returns a 32-bit value, although low-order bits are not mixed */ u32 x = _I(a); @@ -198,14 +192,7 @@ static inline u32 ip4_hash32(ip4_addr a) return x; } -static inline uint ip6_hash(ip6_addr a) -{ - /* Returns a 16-bit hash key */ - u32 x = _I0(a) ^ _I1(a) ^ _I2(a) ^ _I3(a); - return (x ^ (x >> 16) ^ (x >> 8)) & 0xffff; -} - -static inline u32 ip6_hash32(ip6_addr a) +static inline u32 ip6_hash(ip6_addr a) { /* Returns a 32-bit hash key, although low-order bits are not mixed */ u32 x = _I0(a) ^ _I1(a) ^ _I2(a) ^ _I3(a); @@ -218,7 +205,6 @@ static inline int ip4_compare(ip4_addr a, ip4_addr b) int ip6_compare(ip6_addr a, ip6_addr b); #define ipa_hash(x) ip6_hash(x) -#define ipa_hash32(x) ip6_hash32(x) #define ipa_compare(x,y) ip6_compare(x,y) |