xref: /linux/scripts/include/hash.h (revision a16219bdd34777cce35b9b6a704bfbaad28adb72)
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 #ifndef HASH_H
3 #define HASH_H
4 
5 static inline unsigned int hash_str(const char *s)
6 {
7 	/* fnv32 hash */
8 	unsigned int hash = 2166136261U;
9 
10 	for (; *s; s++)
11 		hash = (hash ^ *s) * 0x01000193;
12 	return hash;
13 }
14 
15 #endif /* HASH_H */
16