MCPcopy Create free account
hub / github.com/PaulStoffregen/SerialFlash / filename_hash

Function filename_hash

SerialFlashDirectory.cpp:86–98  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86static uint16_t filename_hash(const char *filename)
87{
88 // http://isthe.com/chongo/tech/comp/fnv/
89 uint32_t hash = 2166136261;
90 const char *p;
91
92 for (p=filename; *p; p++) {
93 hash ^= *p;
94 hash *= 16777619;
95 }
96 hash = (hash % (uint32_t)0xFFFE) + 1; // all values except 0000 & FFFF
97 return hash;
98}
99
100static bool filename_compare(const char *filename, uint32_t straddr)
101{

Callers 2

openMethod · 0.85
createMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected