summaryrefslogtreecommitdiff
path: root/src/GraphemeData.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/GraphemeData.zig')
-rw-r--r--src/GraphemeData.zig12
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
37const Self = @This(); 37const Self = @This();
38 38
39pub fn init(allocator: mem.Allocator) mem.Allocator.Error!Self { 39pub 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
68pub fn deinit(self: *const Self, allocator: mem.Allocator) void { 68pub 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.
75pub fn gbp(self: Self, cp: u21) Gbp { 75pub 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.
80pub fn indic(self: Self, cp: u21) Indic { 80pub 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.
85pub fn isEmoji(self: Self, cp: u21) bool { 85pub 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}