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:
+1
-1
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user