From 598253eac8f8dc93eaa1b19881db52cbfaf56819 Mon Sep 17 00:00:00 2001 From: Ingo Paschke Date: Mon, 25 May 2026 21:37:34 +0200 Subject: [PATCH] glyphs: rotate-5 in glyph_hash eliminates true collisions The previous rotate-1-xor put consecutive characters' bits in adjacent positions, so short similar names like fox/bat or jaguar/lichen collided -- 164 colliding buckets across the 9577 named glyphs. Rotate-5 spreads each character across a 5-bit window: zero true collisions, one m68k ROL.L, no multiplication. The 16 remaining same-hash buckets are name duplicates from a separate compose_glyph_name bug, addressed by its own fix. --- src/glyphs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/glyphs.c b/src/glyphs.c index 837190caf..1d57a4e78 100644 --- a/src/glyphs.c +++ b/src/glyphs.c @@ -618,7 +618,7 @@ glyph_hash(const char *id) if ('A' <= ch && ch <= 'Z') { ch += 'a' - 'A'; } - hash = (hash << 1) | (hash >> 31); + hash = (hash << 5) | (hash >> 27); hash ^= ch; } return hash;