Re: [Vala] FNV Hash algorithm
- From: Denis Kuzmenok <forward_ua ukr net>
- To: Denis Kuzmenok <forward_ua ukr net>
- Cc: vala-list gnome org
- Subject: Re: [Vala] FNV Hash algorithm
- Date: Sun, 8 Jan 2012 21:19:48 +0200
Solved only my making C library and calling via Vapi file =\
What is the equivalent of this C code in vala (For utf8 string also
should work)?
typedef u_int64_t Fnv64_t;
#define FNV_64_INIT ((Fnv64_t)0x84222325cbf29ce4ULL)
#define FNV_64_PRIME ((Fnv64_t)0x100000001b3ULL)
Fnv64_t
fnv_64_str(char *str)
{
Fnv64_t hval = FNV_64_INIT;
unsigned char *s = (unsigned char *)str;
while (*s) {
hval *= FNV_64_PRIME;
hval ^= (Fnv64_t)*s++;
}
return hval;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]