HikoGUI
A low latency retained GUI
Loading...
Searching...
No Matches
ucd_bidi_paired_bracket_types.hpp
1// This file was generated by generate_unicode_data.py
2
3#pragma once
4
5#include "../utility/module.hpp"
6#include <cstdint>
7#include <optional>
8
9namespace hi {
10inline namespace v1 {
11namespace detail {
12
13constexpr auto ucd_bidi_paired_bracket_types_chunk_size = 128_uz;
14constexpr auto ucd_bidi_paired_bracket_types_index_width = 4_uz;
15constexpr auto ucd_bidi_paired_bracket_types_indices_size = 512_uz;
16constexpr auto ucd_bidi_paired_bracket_type_width = 2_uz;
17
18static_assert(std::has_single_bit(ucd_bidi_paired_bracket_types_chunk_size));
19
20constexpr uint8_t ucd_bidi_paired_bracket_types_indices_bytes[272] = {
21 1, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 33, 17, 17, 17, 17, 17, 17, 19, 17, 17, 17, 17, 17, 17, 17, 17, 17,
22 69, 17, 17, 97, 17, 17, 17,120, 17, 25, 17, 17, 17, 17,161, 17,177, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
23 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
24 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
25 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
26 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
27 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,
28 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17, 17,193,209,
29 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
30};
31
32constexpr uint8_t ucd_bidi_paired_bracket_types_bytes[464] = {
33 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 32, 0, 0, 0, 0, 0, 0, 1, 32,
34 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
35 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 6, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
36 0, 0, 0, 0, 0, 0, 1,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
37 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24,
38 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
39 0, 0,102, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
40 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,102,102,102, 96, 0, 0,
41 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 24, 0, 0, 0, 0, 0, 0, 0, 6,102,102, 0, 0, 0, 0,
42 1,153,153,153,153,153,128, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,102, 0, 0, 0, 0, 0, 0, 0, 0, 96,
43 0, 0, 0, 0, 0, 0, 0, 0, 6,102, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25,153,128, 0, 0, 0, 0, 0, 0, 0, 0,
44 0, 0,102,102, 96,102,102, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
45 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 25,152, 0, 0, 0, 0, 0, 0, 0, 0,
46 0, 0, 96, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 32, 0, 0, 0, 0, 0, 0, 1, 33,134, 0, 0, 0, 0, 0, 0, 0,
47 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
48};
49
50
51} // namespace detail
52
53enum class unicode_bidi_paired_bracket_type : uint8_t {
54 n = 0,
55 o = 1,
56 c = 2,
57};
58
59[[nodiscard]] constexpr unicode_bidi_paired_bracket_type ucd_get_bidi_paired_bracket_type(char32_t code_point) noexcept
60{
61 constexpr auto max_code_point_hi = detail::ucd_bidi_paired_bracket_types_indices_size - 1;
62
63 auto code_point_hi = code_point / detail::ucd_bidi_paired_bracket_types_chunk_size;
64 hilet code_point_lo = code_point % detail::ucd_bidi_paired_bracket_types_chunk_size;
65
66 if (code_point_hi > max_code_point_hi) {
67 code_point_hi = max_code_point_hi;
68 }
69
70 hilet chunk_index = load_bits_be<detail::ucd_bidi_paired_bracket_types_index_width>(
71 detail::ucd_bidi_paired_bracket_types_indices_bytes,
72 code_point_hi * detail::ucd_bidi_paired_bracket_types_index_width);
73
74 // Add back in the lower-bits of the code-point.
75 hilet index = (chunk_index * detail::ucd_bidi_paired_bracket_types_chunk_size) + code_point_lo;
76
77 // Get the canonical combining class from the table.
78 hilet value = load_bits_be<detail::ucd_bidi_paired_bracket_type_width>(
79 detail::ucd_bidi_paired_bracket_types_bytes, index * detail::ucd_bidi_paired_bracket_type_width);
80
81 return static_cast<unicode_bidi_paired_bracket_type>(value);
82}
83
84}} // namespace hi::v1
85
#define hilet
Invariant should be the default for variables.
Definition utility.hpp:23
DOXYGEN BUG.
Definition algorithm.hpp:13
geometry/margins.hpp
Definition cache.hpp:11