| 84 | } |
| 85 | |
| 86 | static 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 | |
| 100 | static bool filename_compare(const char *filename, uint32_t straddr) |
| 101 | { |