blob: 660dc14c3de6dae599291dca02e39a8152d0d83c (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
//! Combining Class Data
const Data = struct {
s1: []const u16 = undefined,
s2: []const u8 = undefined,
};
const combining_data = combining_data: {
const data = @import("ccc");
break :combining_data Data{
.s1 = &data.s1,
.s2 = &data.s2,
};
};
const CombiningData = @This();
/// Returns the canonical combining class for a code point.
pub fn ccc(cp: u21) u8 {
return combining_data.s2[combining_data.s1[cp >> 8] + (cp & 0xff)];
}
/// True if `cp` is a starter code point, not a combining character.
pub fn isStarter(cp: u21) bool {
return combining_data.s2[combining_data.s1[cp >> 8] + (cp & 0xff)] == 0;
}
const std = @import("std");
const builtin = @import("builtin");
const mem = std.mem;
|