Ejemplo n.º 1
0
ci_inline unsigned tcp_hash3(ci_netif_filter_table* tbl,
			     unsigned laddr, unsigned lport,
			     unsigned raddr, unsigned rport,
			     unsigned protocol) {
  unsigned h = CI_BSWAP_BE32(raddr) ^ CI_BSWAP_LE32(laddr) ^
               (rport << 16 | lport) ^ protocol;
  h ^= h >> 16;
  h ^= h >> 8;
  return h;
}
Ejemplo n.º 2
0
static unsigned find_extent(const ci_uint8* pdw, unsigned len,
			    int off, ci_uint32 what)
{
  ci_uint8 deadbeef[4];
  unsigned i;

  what = CI_BSWAP_BE32(what);
  memcpy(deadbeef, &what, 4);

  for( i = 0; i < len; ++i )
    if( pdw[i] != deadbeef[(i + off) & 3u] )
      break;

  return i;
}