diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2024-12-26 17:15:52 -0500 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2024-12-26 17:15:52 -0500 |
| commit | 32cbf7b7c8d9634863af6be9defc8a02c780ff82 (patch) | |
| tree | 539483830a13aa5537faa02de445b7ec9623c589 /stdlib | |
| parent | 59b31083a6b3ce7dd786d127620c1766be672202 (diff) | |
Bugfix for text hashing
Diffstat (limited to 'stdlib')
| -rw-r--r-- | stdlib/text.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/stdlib/text.c b/stdlib/text.c index 65d4150a..e25e7bc7 100644 --- a/stdlib/text.c +++ b/stdlib/text.c @@ -829,7 +829,7 @@ PUREFUNC public uint64_t Text$hash(const void *obj, const TypeInfo_t*) switch (text->tag) { case TEXT_ASCII: case TEXT_SHORT_ASCII: { const char *bytes = text->tag == TEXT_ASCII ? text->ascii : text->short_ascii; - for (int64_t i = 0; i + 1 < text->length; i++) { + for (int64_t i = 0; i + 1 < text->length; i += 2) { tmp.chunks[0] = (int32_t)bytes[i]; tmp.chunks[1] = (int32_t)bytes[i+1]; siphashadd64bits(&sh, tmp.whole); @@ -840,7 +840,7 @@ PUREFUNC public uint64_t Text$hash(const void *obj, const TypeInfo_t*) } case TEXT_GRAPHEMES: { const int32_t *graphemes = text->graphemes; - for (int64_t i = 0; i + 1 < text->length; i++) { + for (int64_t i = 0; i + 1 < text->length; i += 2) { tmp.chunks[0] = graphemes[i]; tmp.chunks[1] = graphemes[i]; siphashadd64bits(&sh, tmp.whole); |
