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
31
32
33
34
35
36
37
38
39
40
let[@inline] pack_u u = if u > 0xd7ff then u - 0x800 else u
let[@inline] get u =
let packed = pack_u (Uchar.to_int u) in
let block_id =
Char.code (String.unsafe_get Unicode_data.prop_index (packed lsr 8))
in
let off = (block_id lsl 9) lor ((packed land 0xFF) lsl 1) in
Char.code (String.unsafe_get Unicode_data.prop_data off)
lor (Char.code (String.unsafe_get Unicode_data.prop_data (off + 1)) lsl 8)
let[@inline] grapheme_cluster_break u = get u land 0x1F
let[@inline] indic_conjunct_break u = (get u lsr 5) land 0x03
let[@inline] is_extended_pictographic u = get u land 0x80 <> 0
let[@inline] tty_width_hint u = ((get u lsr 8) land 0x03) - 1
let[@inline] grapheme_props u = get u land 0xFF
let[@inline] all_props u = get u