MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / bkdr_hash

Function bkdr_hash

components/dfs/dfs_v1/src/dfs_file.c:88–99  ·  view source on GitHub ↗

BKDR Hash Function */

Source from the content-addressed store, hash-verified

86
87/* BKDR Hash Function */
88static unsigned int bkdr_hash(const char *str)
89{
90 unsigned int seed = 131; /* 31 131 1313 13131 131313 etc..*/
91 unsigned int hash = 0;
92
93 while (*str)
94 {
95 hash = hash * seed + (*str++);
96 }
97
98 return (hash % DFS_VNODE_HASH_NR);
99}
100
101/**
102 * @brief Find a DFS vnode by its path.

Callers 1

dfs_vnode_findFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected