use INLINE instead of inline
[cparser] / adt / hash_string.h
1 #ifndef _FIRM_HASH_STRING_H_
2 #define _FIRM_HASH_STRING_H_
3
4 #define _FIRM_FNV_OFFSET_BASIS 2166136261U
5 #define _FIRM_FNV_FNV_PRIME 16777619U
6
7 static INLINE __attribute__((pure))
8 unsigned hash_string(const char* str)
9 {
10         const unsigned char *p;
11         unsigned hash = _FIRM_FNV_OFFSET_BASIS;
12
13         for(p = (const unsigned char*) str; *p != 0; ++p) {
14                 hash *= _FIRM_FNV_FNV_PRIME;
15                 hash ^= *p;
16         }
17
18         return hash;
19 }
20
21 static INLINE __attribute__((pure))
22 unsigned hash_string_size(const char* str, size_t size)
23 {
24         size_t i;
25         unsigned hash = _FIRM_FNV_OFFSET_BASIS;
26
27         for(i = 0; i < size; ++i) {
28                 hash *= _FIRM_FNV_FNV_PRIME;
29                 hash ^= str[i];
30         }
31
32         return hash;
33 }
34
35 #endif