Coconut Framework  beta
CNStrUtil.h
Go to the documentation of this file.
1 
8 #ifndef CNSTRUTIL_H
9 #define CNSTRUTIL_H
10 
11 #include <stdint.h>
12 #include <string.h>
13 
19 static inline size_t
20 CNLengthOfUTF8String(const unsigned char * src)
21 {
22  return strlen((const char *) src) ;
23 }
24 
31 uint64_t
32 CNCalcHashValueForString(size_t len, const unsigned char * str) ;
33 
40 static inline unsigned int
41 CNHashValueToIndex(uint64_t hashval, unsigned int maxnum)
42 {
43  return (hashval / 31) % maxnum ;
44 }
45 
46 #endif /* CNSTRUTIL_H */
47 
static unsigned int CNHashValueToIndex(uint64_t hashval, unsigned int maxnum)
Get index value from hash value.
Definition: CNStrUtil.h:41
uint64_t CNCalcHashValueForString(size_t len, const unsigned char *str)
Calculate hash value for string.
static size_t CNLengthOfUTF8String(const unsigned char *src)
Get length of UTF8String.
Definition: CNStrUtil.h:20