mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-01-06 05:17:50 +00:00
Glphkey.hash CityHash64 -> hash.int
This commit is contained in:
committed by
Mitchell Hashimoto
parent
8824256059
commit
cf39d5c512
@@ -332,11 +332,15 @@ const GlyphKey = struct {
|
||||
|
||||
const Context = struct {
|
||||
pub fn hash(_: Context, key: GlyphKey) u64 {
|
||||
// Packed is a u64 but std.hash.int improves uniformity and
|
||||
// avoids collisions in our hashmap.
|
||||
const packed_key = Packed.from(key);
|
||||
return std.hash.CityHash64.hash(std.mem.asBytes(&packed_key));
|
||||
return std.hash.int(@as(u64, @bitCast(packed_key)));
|
||||
}
|
||||
|
||||
pub fn eql(_: Context, a: GlyphKey, b: GlyphKey) bool {
|
||||
// Packed checks glyphs but in most cases the glyphs are NOT
|
||||
// equal so the first check leads to increased throughput.
|
||||
return a.glyph == b.glyph and Packed.from(a) == Packed.from(b);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user