diff --git a/src/unicode/lut.zig b/src/unicode/lut.zig index e709bf1fe..e10c5c0b8 100644 --- a/src/unicode/lut.zig +++ b/src/unicode/lut.zig @@ -83,7 +83,7 @@ pub fn Generator( block_len += 1; // If we still have space and we're not done with codepoints, - // we keep building up the bock. Conversely: we finalize this + // we keep building up the block. Conversely: we finalize this // block if we've filled it or are out of codepoints. if (block_len < block_size and cp != std.math.maxInt(u21)) continue; if (block_len < block_size) @memset(block[block_len..block_size], 0); @@ -136,38 +136,12 @@ pub fn Tables(comptime Elem: type) type { stage3: []const Elem, /// Given a codepoint, returns the mapping for that codepoint. - pub fn get(self: *const Self, cp: u21) Elem { + pub inline fn get(self: *const Self, cp: u21) Elem { const high = cp >> 8; const low = cp & 0xFF; return self.stage3[self.stage2[self.stage1[high] + low]]; } - pub inline fn getInline(self: *const Self, cp: u21) Elem { - const high = cp >> 8; - const low = cp & 0xFF; - return self.stage3[self.stage2[self.stage1[high] + low]]; - } - - pub fn getBool(self: *const Self, cp: u21) bool { - assert(Elem == bool); - assert(self.stage3.len == 2); - assert(self.stage3[0] == false); - assert(self.stage3[1] == true); - const high = cp >> 8; - const low = cp & 0xFF; - return self.stage2[self.stage1[high] + low] != 0; - } - - pub inline fn getBoolInline(self: *const Self, cp: u21) bool { - assert(Elem == bool); - assert(self.stage3.len == 2); - assert(self.stage3[0] == false); - assert(self.stage3[1] == true); - const high = cp >> 8; - const low = cp & 0xFF; - return self.stage2[self.stage1[high] + low] != 0; - } - /// Writes the lookup table as Zig to the given writer. The /// written file exports three constants: stage1, stage2, and /// stage3. These can be used to rebuild the lookup table in Zig. @@ -199,6 +173,7 @@ pub fn Tables(comptime Elem: type) type { \\}; \\ }; \\} + \\ ); } }; diff --git a/src/unicode/symbols.zig b/src/unicode/symbols.zig index 3e038fe7d..3c2a84e76 100644 --- a/src/unicode/symbols.zig +++ b/src/unicode/symbols.zig @@ -78,7 +78,9 @@ pub fn main() !void { // This is not very fast in debug modes, so its commented by default. // IMPORTANT: UNCOMMENT THIS WHENEVER MAKING CHANGES. -test "unicode symbols1: tables match ziglyph" { +test "unicode symbols: tables match ziglyph" { + if (std.valgrind.runningOnValgrind() > 0) return error.SkipZigTest; + const testing = std.testing; for (0..std.math.maxInt(u21)) |cp| {