From e49eef7e53025e046292d91b6072571706577eb6 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Sun, 7 Jun 2026 20:47:32 -0700 Subject: [PATCH] toLower: use binary search --- src/root.zig | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/root.zig b/src/root.zig index e6c0e438a4bb4bec219cbc45984250565216b934..61879a5f182a1cc771dcd74a4bee157e2c60f560 100644 --- a/src/root.zig +++ b/src/root.zig @@ -70,11 +70,6 @@ pub fn bidiPairedBracketType(cp: u32) ?ucd.bidi_brackets.BracketPairing.Type { } pub fn toLower(cp: u32) ?u32 { - @setEvalBranchQuota(100_000); - inline for (ucd.unicode_data.data) |row| { - if (comptime row[11]) |lc| { - if (cp == row[0]) return lc; - } - } - return null; + if (cp > std.math.maxInt(u21)) return null; + return ucd.unicode_data.find(@intCast(cp))[11] orelse null; // https://github.com/ziglang/zig/issues/16765 } -- 2.54.0