mirror of
https://github.com/ghostty-org/ghostty.git
synced 2026-04-19 14:00:29 +00:00
simd: remove ziglyph fallback
This commit is contained in:
@@ -22,29 +22,24 @@ test "codepointWidth basic" {
|
||||
// try testing.expectEqual(@as(i8, 1), @import("ziglyph").display_width.codePointWidth(0x100, .half));
|
||||
}
|
||||
|
||||
pub export fn ghostty_ziglyph_codepoint_width(cp: u32) callconv(.C) i8 {
|
||||
return @import("ziglyph").display_width.codePointWidth(@intCast(cp), .half);
|
||||
}
|
||||
|
||||
test "codepointWidth matches ziglyph" {
|
||||
const testing = std.testing;
|
||||
const ziglyph = @import("ziglyph");
|
||||
|
||||
// try testing.expect(ziglyph.general_category.isNonspacingMark(0x16fe4));
|
||||
// if (true) return;
|
||||
|
||||
const min = 0xFF + 1; // start outside ascii
|
||||
for (min..std.math.maxInt(u21)) |cp| {
|
||||
const simd = codepointWidth(@intCast(cp));
|
||||
const zg = ziglyph.display_width.codePointWidth(@intCast(cp), .half);
|
||||
if (simd != zg) mismatch: {
|
||||
if (cp == 0x2E3B) {
|
||||
try testing.expectEqual(@as(i8, 2), simd);
|
||||
break :mismatch;
|
||||
}
|
||||
|
||||
std.log.warn("mismatch cp=U+{x} simd={} zg={}", .{ cp, simd, zg });
|
||||
try testing.expect(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
// This is not very fast in debug modes, so its commented by default.
|
||||
// IMPORTANT: UNCOMMENT THIS WHENEVER MAKING CODEPOINTWIDTH CHANGES.
|
||||
// test "codepointWidth matches ziglyph" {
|
||||
// const testing = std.testing;
|
||||
// const ziglyph = @import("ziglyph");
|
||||
//
|
||||
// const min = 0xFF + 1; // start outside ascii
|
||||
// for (min..std.math.maxInt(u21)) |cp| {
|
||||
// const simd = codepointWidth(@intCast(cp));
|
||||
// const zg = ziglyph.display_width.codePointWidth(@intCast(cp), .half);
|
||||
// if (simd != zg) mismatch: {
|
||||
// if (cp == 0x2E3B) {
|
||||
// try testing.expectEqual(@as(i8, 2), simd);
|
||||
// break :mismatch;
|
||||
// }
|
||||
//
|
||||
// std.log.warn("mismatch cp=U+{x} simd={} zg={}", .{ cp, simd, zg });
|
||||
// try testing.expect(false);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
|
||||
Reference in New Issue
Block a user