Hash a span of source text. */
| 56 | |
| 57 | /* Hash a span of source text. */ |
| 58 | static uint32_t hash_source_span(const char *source, uint32_t start, int len) { |
| 59 | uint32_t h = 0; |
| 60 | for (int x = 0; x < len; x++) { |
| 61 | h = (h * FP_HASH_MUL) + (uint32_t)(unsigned char)source[start + (uint32_t)x]; |
| 62 | } |
| 63 | return h; |
| 64 | } |
| 65 | |
| 66 | /* Try to append a unique identifier to the buffer. Returns true if appended. */ |
| 67 | static bool try_append_ident(const char *source, uint32_t s, int len, uint32_t *seen, int seen_size, |