summaryrefslogtreecommitdiff
path: root/src/libstddjb/cdb_hashv.c
blob: e2b80d9b6f14c7b2ef144ef2ddbc53fba204d34b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/* ISC license. */

#include <stdint.h>

#include "cdb-internal.h"

uint32_t cdb_hashv (struct iovec const *v, unsigned int n)
{
  uint32_t h = CDB_HASHSTART ;
  for (unsigned int i = 0 ; i < n ; i++)
    for (size_t j = 0 ; j < v[i].iov_len ; j++)
      h = cdb_hashadd(h, ((uint8_t const *)v[i].iov_base)[j]) ;
  return h ;
}