blob: d443ba0af3027083acb35ce6bc7285cf018270b5 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
/* See LICENSE file for copyright and license details. */
#include "common.h"
int
libcmap_find_in_no_block(uint32_t codepoint, size_t *offset_out, size_t *subrange_out)
{
size_t i, skipped = 0;
for (i = 0; i < libcmap_no_block.nranges; i++) {
if (libcmap_no_block.ranges[i].first <= codepoint && libcmap_no_block.ranges[i].last <= codepoint) {
if (offset_out)
*offset_out = skipped + (size_t)(codepoint - libcmap_no_block.ranges[i].first);
if (subrange_out)
*subrange_out = i;
return 1;
}
skipped += (size_t)(libcmap_no_block.ranges[i].last - libcmap_no_block.ranges[i].first) + 1U;
}
return 0;
}
|