Revision 04632fd7 lib/ip.h

View differences:

lib/ip.h
91 91

  
92 92
#define ipa_is_ip4(a) ip6_is_v4mapped(a)
93 93

  
94
#define IPA_NONE4 ipa_from_ip4(IP4_NONE)
95
#define IPA_NONE6 ipa_from_ip6(IP6_NONE)
96

  
94 97

  
95 98
/*
96 99
 *	Public constructors
......
180 183
 *	Hash and compare functions
181 184
 */
182 185

  
183
static inline uint ip4_hash(ip4_addr a)
184
{
185
  /* Returns a 16-bit value */
186
  u32 x = _I(a);
187
  x ^= x >> 16;
188
  x ^= x << 10;
189
  return x & 0xffff;
190
}
191

  
192
static inline u32 ip4_hash32(ip4_addr a)
186
static inline u32 ip4_hash(ip4_addr a)
193 187
{
194 188
  /* Returns a 32-bit value, although low-order bits are not mixed */
195 189
  u32 x = _I(a);
......
198 192
  return x;
199 193
}
200 194

  
201
static inline uint ip6_hash(ip6_addr a)
202
{
203
  /* Returns a 16-bit hash key */
204
  u32 x = _I0(a) ^ _I1(a) ^ _I2(a) ^ _I3(a);
205
  return (x ^ (x >> 16) ^ (x >> 8)) & 0xffff;
206
}
207

  
208
static inline u32 ip6_hash32(ip6_addr a)
195
static inline u32 ip6_hash(ip6_addr a)
209 196
{
210 197
  /* Returns a 32-bit hash key, although low-order bits are not mixed */
211 198
  u32 x = _I0(a) ^ _I1(a) ^ _I2(a) ^ _I3(a);
......
218 205
int ip6_compare(ip6_addr a, ip6_addr b);
219 206

  
220 207
#define ipa_hash(x) ip6_hash(x)
221
#define ipa_hash32(x) ip6_hash32(x)
222 208
#define ipa_compare(x,y) ip6_compare(x,y)
223 209

  
224 210

  

Also available in: Unified diff