From 339eaebfe4242db4f30e41c13c5cd35cc80750b0 Mon Sep 17 00:00:00 2001 From: Jose Colon Rodriguez Date: Wed, 26 Jun 2024 13:56:44 -0400 Subject: Removed all inlines --- src/CanonData.zig | 4 ++-- src/CaseData.zig | 6 +++--- src/CombiningData.zig | 4 ++-- src/CompatData.zig | 2 +- src/FoldData.zig | 10 ++++++---- src/GenCatData.zig | 2 +- src/GraphemeData.zig | 6 +++--- src/HangulData.zig | 2 +- src/NormPropsData.zig | 6 +++--- src/PropsData.zig | 24 ++++++++++++------------ src/WidthData.zig | 2 +- 11 files changed, 35 insertions(+), 33 deletions(-) (limited to 'src') diff --git a/src/CanonData.zig b/src/CanonData.zig index be2b381..05b9017 100644 --- a/src/CanonData.zig +++ b/src/CanonData.zig @@ -56,11 +56,11 @@ pub fn deinit(self: *Self) void { } /// Returns canonical decomposition for `cp`. -pub inline fn toNfd(self: Self, cp: u21) []const u21 { +pub fn toNfd(self: Self, cp: u21) []const u21 { return self.nfd[cp]; } // Returns the primary composite for the codepoints in `cp`. -pub inline fn toNfc(self: Self, cps: [2]u21) ?u21 { +pub fn toNfc(self: Self, cps: [2]u21) ?u21 { return self.nfc.get(cps); } diff --git a/src/CaseData.zig b/src/CaseData.zig index 260637a..3a35fdd 100644 --- a/src/CaseData.zig +++ b/src/CaseData.zig @@ -81,7 +81,7 @@ pub fn deinit(self: *const Self) void { } // Returns true if `cp` is either upper, lower, or title case. -pub inline fn isCased(self: Self, cp: u21) bool { +pub fn isCased(self: Self, cp: u21) bool { return self.prop_s2[self.prop_s1[cp >> 8] + (cp & 0xff)] & 4 == 4; } @@ -109,7 +109,7 @@ test "isUpperStr" { } /// Returns uppercase mapping for `cp`. -pub inline fn toUpper(self: Self, cp: u21) u21 { +pub fn toUpper(self: Self, cp: u21) u21 { return self.case_map[cp][0]; } @@ -167,7 +167,7 @@ test "isLowerStr" { } /// Returns lowercase mapping for `cp`. -pub inline fn toLower(self: Self, cp: u21) u21 { +pub fn toLower(self: Self, cp: u21) u21 { return self.case_map[cp][1]; } diff --git a/src/CombiningData.zig b/src/CombiningData.zig index 16b923f..44140f8 100644 --- a/src/CombiningData.zig +++ b/src/CombiningData.zig @@ -39,11 +39,11 @@ pub fn deinit(self: *const Self) void { } /// Returns the canonical combining class for a code point. -pub inline fn ccc(self: Self, cp: u21) u8 { +pub fn ccc(self: Self, cp: u21) u8 { return self.s2[self.s1[cp >> 8] + (cp & 0xff)]; } /// True if `cp` is a starter code point, not a combining character. -pub inline fn isStarter(self: Self, cp: u21) bool { +pub fn isStarter(self: Self, cp: u21) bool { return self.s2[self.s1[cp >> 8] + (cp & 0xff)] == 0; } diff --git a/src/CompatData.zig b/src/CompatData.zig index 3346a06..cf184a1 100644 --- a/src/CompatData.zig +++ b/src/CompatData.zig @@ -45,6 +45,6 @@ pub fn deinit(self: *const Self) void { } /// Returns compatibility decomposition for `cp`. -pub inline fn toNfkd(self: Self, cp: u21) []u21 { +pub fn toNfkd(self: Self, cp: u21) []u21 { return self.nfkd[cp]; } diff --git a/src/FoldData.zig b/src/FoldData.zig index 892f78f..b7bbbd1 100644 --- a/src/FoldData.zig +++ b/src/FoldData.zig @@ -3,9 +3,11 @@ const builtin = @import("builtin"); const compress = std.compress; const mem = std.mem; +const cwcf_max = 0x1e950; + allocator: mem.Allocator, cutoff: u21 = undefined, -cwcf: [0x10ffff]bool = [_]bool{false} ** 0x10ffff, +cwcf: [cwcf_max]bool = [_]bool{false} ** cwcf_max, multiple_start: u21 = undefined, stage1: []u8 = undefined, stage2: []u8 = undefined, @@ -54,7 +56,7 @@ pub fn deinit(self: *const Self) void { } /// Returns the case fold for `cp`. -pub inline fn caseFold(self: Self, cp: u21, buf: []u21) []const u21 { +pub fn caseFold(self: Self, cp: u21, buf: []u21) []const u21 { if (cp >= self.cutoff) return &.{}; const stage1_val = self.stage1[cp >> 8]; @@ -80,6 +82,6 @@ pub inline fn caseFold(self: Self, cp: u21, buf: []u21) []const u21 { } /// Returns true when caseFold(NFD(`cp`)) != NFD(`cp`). -pub inline fn changesWhenCaseFolded(self: Self, cp: u21) bool { - return self.cwcf[cp]; +pub fn changesWhenCaseFolded(self: Self, cp: u21) bool { + return cp < cwcf_max and self.cwcf[cp]; } diff --git a/src/GenCatData.zig b/src/GenCatData.zig index 454c45a..5ce9fb6 100644 --- a/src/GenCatData.zig +++ b/src/GenCatData.zig @@ -80,7 +80,7 @@ pub fn deinit(self: *const Self) void { } /// Lookup the General Category for `cp`. -pub inline fn gc(self: Self, cp: u21) Gc { +pub fn gc(self: Self, cp: u21) Gc { return @enumFromInt(self.s3[self.s2[self.s1[cp >> 8] + (cp & 0xff)]]); } diff --git a/src/GraphemeData.zig b/src/GraphemeData.zig index 1710870..0ed79f2 100644 --- a/src/GraphemeData.zig +++ b/src/GraphemeData.zig @@ -73,16 +73,16 @@ pub fn deinit(self: *const Self) void { } /// Lookup the grapheme break property for a code point. -pub inline fn gbp(self: Self, cp: u21) Gbp { +pub fn gbp(self: Self, cp: u21) Gbp { return @enumFromInt(self.s3[self.s2[self.s1[cp >> 8] + (cp & 0xff)]] >> 4); } /// Lookup the indic syllable type for a code point. -pub inline fn indic(self: Self, cp: u21) Indic { +pub fn indic(self: Self, cp: u21) Indic { return @enumFromInt((self.s3[self.s2[self.s1[cp >> 8] + (cp & 0xff)]] >> 1) & 0x7); } /// Lookup the indic syllable type for a code point. -pub inline fn isEmoji(self: Self, cp: u21) bool { +pub fn isEmoji(self: Self, cp: u21) bool { return self.s3[self.s2[self.s1[cp >> 8] + (cp & 0xff)]] & 1 == 1; } diff --git a/src/HangulData.zig b/src/HangulData.zig index 5eee427..048841d 100644 --- a/src/HangulData.zig +++ b/src/HangulData.zig @@ -48,6 +48,6 @@ pub fn deinit(self: *const Self) void { } /// Returns the Hangul syllable type for `cp`. -pub inline fn syllable(self: Self, cp: u21) Syllable { +pub fn syllable(self: Self, cp: u21) Syllable { return @enumFromInt(self.s2[self.s1[cp >> 8] + (cp & 0xff)]); } diff --git a/src/NormPropsData.zig b/src/NormPropsData.zig index 899bb8f..5861860 100644 --- a/src/NormPropsData.zig +++ b/src/NormPropsData.zig @@ -39,16 +39,16 @@ pub fn deinit(self: *const Self) void { } /// Returns true if `cp` is already in NFD form. -pub inline fn isNfd(self: Self, cp: u21) bool { +pub fn isNfd(self: Self, cp: u21) bool { return self.s2[self.s1[cp >> 8] + (cp & 0xff)] & 1 == 0; } /// Returns true if `cp` is already in NFKD form. -pub inline fn isNfkd(self: Self, cp: u21) bool { +pub fn isNfkd(self: Self, cp: u21) bool { return self.s2[self.s1[cp >> 8] + (cp & 0xff)] & 2 == 0; } /// Returns true if `cp` is not allowed in any normalized form. -pub inline fn isFcx(self: Self, cp: u21) bool { +pub fn isFcx(self: Self, cp: u21) bool { return self.s2[self.s1[cp >> 8] + (cp & 0xff)] & 4 == 4; } diff --git a/src/PropsData.zig b/src/PropsData.zig index f6c8370..b77bf30 100644 --- a/src/PropsData.zig +++ b/src/PropsData.zig @@ -81,62 +81,62 @@ pub fn deinit(self: *const Self) void { } /// True if `cp` is a mathematical symbol. -pub inline fn isMath(self: Self, cp: u21) bool { +pub fn isMath(self: Self, cp: u21) bool { return self.core_s2[self.core_s1[cp >> 8] + (cp & 0xff)] & 1 == 1; } /// True if `cp` is an alphabetic character. -pub inline fn isAlphabetic(self: Self, cp: u21) bool { +pub fn isAlphabetic(self: Self, cp: u21) bool { return self.core_s2[self.core_s1[cp >> 8] + (cp & 0xff)] & 2 == 2; } /// True if `cp` is a valid identifier start character. -pub inline fn isIdStart(self: Self, cp: u21) bool { +pub fn isIdStart(self: Self, cp: u21) bool { return self.core_s2[self.core_s1[cp >> 8] + (cp & 0xff)] & 4 == 4; } /// True if `cp` is a valid identifier continuation character. -pub inline fn isIdContinue(self: Self, cp: u21) bool { +pub fn isIdContinue(self: Self, cp: u21) bool { return self.core_s2[self.core_s1[cp >> 8] + (cp & 0xff)] & 8 == 8; } /// True if `cp` is a valid extended identifier start character. -pub inline fn isXidStart(self: Self, cp: u21) bool { +pub fn isXidStart(self: Self, cp: u21) bool { return self.core_s2[self.core_s1[cp >> 8] + (cp & 0xff)] & 16 == 16; } /// True if `cp` is a valid extended identifier continuation character. -pub inline fn isXidContinue(self: Self, cp: u21) bool { +pub fn isXidContinue(self: Self, cp: u21) bool { return self.core_s2[self.core_s1[cp >> 8] + (cp & 0xff)] & 32 == 32; } /// True if `cp` is a whitespace character. -pub inline fn isWhitespace(self: Self, cp: u21) bool { +pub fn isWhitespace(self: Self, cp: u21) bool { return self.props_s2[self.props_s1[cp >> 8] + (cp & 0xff)] & 1 == 1; } /// True if `cp` is a hexadecimal digit. -pub inline fn isHexDigit(self: Self, cp: u21) bool { +pub fn isHexDigit(self: Self, cp: u21) bool { return self.props_s2[self.props_s1[cp >> 8] + (cp & 0xff)] & 2 == 2; } /// True if `cp` is a diacritic mark. -pub inline fn isDiacritic(self: Self, cp: u21) bool { +pub fn isDiacritic(self: Self, cp: u21) bool { return self.props_s2[self.props_s1[cp >> 8] + (cp & 0xff)] & 4 == 4; } /// True if `cp` is numeric. -pub inline fn isNumeric(self: Self, cp: u21) bool { +pub fn isNumeric(self: Self, cp: u21) bool { return self.num_s2[self.num_s1[cp >> 8] + (cp & 0xff)] & 1 == 1; } /// True if `cp` is a digit. -pub inline fn isDigit(self: Self, cp: u21) bool { +pub fn isDigit(self: Self, cp: u21) bool { return self.num_s2[self.num_s1[cp >> 8] + (cp & 0xff)] & 2 == 2; } /// True if `cp` is decimal. -pub inline fn isDecimal(self: Self, cp: u21) bool { +pub fn isDecimal(self: Self, cp: u21) bool { return self.num_s2[self.num_s1[cp >> 8] + (cp & 0xff)] & 4 == 4; } diff --git a/src/WidthData.zig b/src/WidthData.zig index cf31b7f..1f1ae6f 100644 --- a/src/WidthData.zig +++ b/src/WidthData.zig @@ -52,7 +52,7 @@ pub fn deinit(self: *const Self) void { /// 3, where BACKSPACE and DELETE return -1 and 3-em-dash returns 3. C0/C1 /// control codes return 0. If `cjk` is true, ambiguous code points return 2, /// otherwise they return 1. -pub inline fn codePointWidth(self: Self, cp: u21) i3 { +pub fn codePointWidth(self: Self, cp: u21) i3 { return self.s2[self.s1[cp >> 8] + (cp & 0xff)]; } -- cgit v1.2.3