skalibs

Mirror/fork of https://skarnet.org/software/skalibs/
git clone https://ccx.te2000.cz/git/skalibs
Log | Files | Refs | README | LICENSE

cdb_hashv.c (328B)


      1 /* ISC license. */
      2 
      3 #include <stdint.h>
      4 
      5 #include "cdb-internal.h"
      6 
      7 uint32_t cdb_hashv (struct iovec const *v, unsigned int n)
      8 {
      9   uint32_t h = CDB_HASHSTART ;
     10   for (unsigned int i = 0 ; i < n ; i++)
     11     for (size_t j = 0 ; j < v[i].iov_len ; j++)
     12       h = cdb_hashadd(h, ((uint8_t const *)v[i].iov_base)[j]) ;
     13   return h ;
     14 }