diff options
| author | 2024-06-26 13:56:44 -0400 | |
|---|---|---|
| committer | 2024-06-26 13:56:44 -0400 | |
| commit | 339eaebfe4242db4f30e41c13c5cd35cc80750b0 (patch) | |
| tree | a9e55d10b6f504830de6a4882c131945f2d9ad07 /src/FoldData.zig | |
| parent | Added changes when casefolded back (diff) | |
| download | zg-339eaebfe4242db4f30e41c13c5cd35cc80750b0.tar.gz zg-339eaebfe4242db4f30e41c13c5cd35cc80750b0.tar.xz zg-339eaebfe4242db4f30e41c13c5cd35cc80750b0.zip | |
Removed all inlines
Diffstat (limited to 'src/FoldData.zig')
| -rw-r--r-- | src/FoldData.zig | 10 |
1 files changed, 6 insertions, 4 deletions
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"); | |||
| 3 | const compress = std.compress; | 3 | const compress = std.compress; |
| 4 | const mem = std.mem; | 4 | const mem = std.mem; |
| 5 | 5 | ||
| 6 | const cwcf_max = 0x1e950; | ||
| 7 | |||
| 6 | allocator: mem.Allocator, | 8 | allocator: mem.Allocator, |
| 7 | cutoff: u21 = undefined, | 9 | cutoff: u21 = undefined, |
| 8 | cwcf: [0x10ffff]bool = [_]bool{false} ** 0x10ffff, | 10 | cwcf: [cwcf_max]bool = [_]bool{false} ** cwcf_max, |
| 9 | multiple_start: u21 = undefined, | 11 | multiple_start: u21 = undefined, |
| 10 | stage1: []u8 = undefined, | 12 | stage1: []u8 = undefined, |
| 11 | stage2: []u8 = undefined, | 13 | stage2: []u8 = undefined, |
| @@ -54,7 +56,7 @@ pub fn deinit(self: *const Self) void { | |||
| 54 | } | 56 | } |
| 55 | 57 | ||
| 56 | /// Returns the case fold for `cp`. | 58 | /// Returns the case fold for `cp`. |
| 57 | pub inline fn caseFold(self: Self, cp: u21, buf: []u21) []const u21 { | 59 | pub fn caseFold(self: Self, cp: u21, buf: []u21) []const u21 { |
| 58 | if (cp >= self.cutoff) return &.{}; | 60 | if (cp >= self.cutoff) return &.{}; |
| 59 | 61 | ||
| 60 | const stage1_val = self.stage1[cp >> 8]; | 62 | const stage1_val = self.stage1[cp >> 8]; |
| @@ -80,6 +82,6 @@ pub inline fn caseFold(self: Self, cp: u21, buf: []u21) []const u21 { | |||
| 80 | } | 82 | } |
| 81 | 83 | ||
| 82 | /// Returns true when caseFold(NFD(`cp`)) != NFD(`cp`). | 84 | /// Returns true when caseFold(NFD(`cp`)) != NFD(`cp`). |
| 83 | pub inline fn changesWhenCaseFolded(self: Self, cp: u21) bool { | 85 | pub fn changesWhenCaseFolded(self: Self, cp: u21) bool { |
| 84 | return self.cwcf[cp]; | 86 | return cp < cwcf_max and self.cwcf[cp]; |
| 85 | } | 87 | } |