blob: 8b048c0570019b82e48c8bd685470e49c2e2ebf9 (
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
|
/* See LICENSE file for copyright and license details. */
#include "common.h"
const struct libcmap_codepoint_data *
libcmap_find_codepoint_data(uint32_t codepoint)
{
size_t low = 0u, high = libcmap_codepoint_list_size - 1u;
size_t i;
while (low <= high) {
i = low + (high - low) / 2u;
if (libcmap_codepoint_list[i].range.last < codepoint) {
low = i + 1u;
} else if (libcmap_codepoint_list[i].range.first > codepoint) {
if (!high)
break;
high = i - 1u;
} else {
return &libcmap_codepoint_list[i].data[codepoint - libcmap_codepoint_list[i].range.first];
}
}
return NULL;
}
|