diff options
Diffstat (limited to 'src/GraphemeData.zig')
| -rw-r--r-- | src/GraphemeData.zig | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/GraphemeData.zig b/src/GraphemeData.zig index 6d3174d..df025cb 100644 --- a/src/GraphemeData.zig +++ b/src/GraphemeData.zig | |||
| @@ -36,7 +36,7 @@ s3: []u8 = undefined, | |||
| 36 | 36 | ||
| 37 | const Self = @This(); | 37 | const Self = @This(); |
| 38 | 38 | ||
| 39 | pub fn init(allocator: mem.Allocator) mem.Allocator.Error!Self { | 39 | pub inline fn init(allocator: mem.Allocator) mem.Allocator.Error!Self { |
| 40 | const decompressor = compress.flate.inflate.decompressor; | 40 | const decompressor = compress.flate.inflate.decompressor; |
| 41 | const in_bytes = @embedFile("gbp"); | 41 | const in_bytes = @embedFile("gbp"); |
| 42 | var in_fbs = std.io.fixedBufferStream(in_bytes); | 42 | var in_fbs = std.io.fixedBufferStream(in_bytes); |
| @@ -65,23 +65,23 @@ pub fn init(allocator: mem.Allocator) mem.Allocator.Error!Self { | |||
| 65 | return self; | 65 | return self; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | pub fn deinit(self: *const Self, allocator: mem.Allocator) void { | 68 | pub inline fn deinit(self: *const Self, allocator: mem.Allocator) void { |
| 69 | allocator.free(self.s1); | 69 | allocator.free(self.s1); |
| 70 | allocator.free(self.s2); | 70 | allocator.free(self.s2); |
| 71 | allocator.free(self.s3); | 71 | allocator.free(self.s3); |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | /// Lookup the grapheme break property for a code point. | 74 | /// Lookup the grapheme break property for a code point. |
| 75 | pub fn gbp(self: Self, cp: u21) Gbp { | 75 | pub inline fn gbp(self: Self, cp: u21) Gbp { |
| 76 | return @enumFromInt(self.s3[self.s2[self.s1[cp >> 8] + (cp & 0xff)]] >> 4); | 76 | return @enumFromInt(self.s3[self.s2[self.s1[cp >> 8] + (cp & 0xff)]] >> 4); |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | /// Lookup the indic syllable type for a code point. | 79 | /// Lookup the indic syllable type for a code point. |
| 80 | pub fn indic(self: Self, cp: u21) Indic { | 80 | pub inline fn indic(self: Self, cp: u21) Indic { |
| 81 | return @enumFromInt((self.s3[self.s2[self.s1[cp >> 8] + (cp & 0xff)]] >> 1) & 0x7); | 81 | return @enumFromInt((self.s3[self.s2[self.s1[cp >> 8] + (cp & 0xff)]] >> 1) & 0x7); |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | /// Lookup the indic syllable type for a code point. | 84 | /// Lookup the emoji property for a code point. |
| 85 | pub fn isEmoji(self: Self, cp: u21) bool { | 85 | pub inline fn isEmoji(self: Self, cp: u21) bool { |
| 86 | return self.s3[self.s2[self.s1[cp >> 8] + (cp & 0xff)]] & 1 == 1; | 86 | return self.s3[self.s2[self.s1[cp >> 8] + (cp & 0xff)]] & 1 == 1; |
| 87 | } | 87 | } |