1 /* SPDX-License-Identifier: GPL-2.0-only */ 1 2 #ifndef HASH_H 3 #define HASH_H 4 5 static inline unsigned int hash_str(const char 6 { 7 /* fnv32 hash */ 8 unsigned int hash = 2166136261U; 9 10 for (; *s; s++) 11 hash = (hash ^ *s) * 0x0100019 12 return hash; 13 } 14 15 /* simplified version of functions from includ 16 #define GOLDEN_RATIO_32 0x61C88647 17 18 static inline unsigned int hash_32(unsigned in 19 { 20 return 0x61C88647 * val; 21 } 22 23 static inline unsigned int hash_ptr(const void 24 { 25 return hash_32((unsigned int)(unsigned 26 } 27 28 #endif /* HASH_H */ 29
Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.