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.
This commit is contained in:
Ingo Paschke
2026-05-25 15:45:25 -04:00
committed by nhmall
parent b4f417f2ca
commit 598253eac8
+1 -1
View File
@@ -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;