summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-unicode-ranges.hh
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/harfbuzz-ng/src/hb-ot-os2-unicode-ranges.hh')
-rw-r--r--src/3rdparty/harfbuzz-ng/src/hb-ot-os2-unicode-ranges.hh28
1 files changed, 6 insertions, 22 deletions
diff --git a/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-unicode-ranges.hh b/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-unicode-ranges.hh
index b0ccd00d7b..01e6a46e63 100644
--- a/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-unicode-ranges.hh
+++ b/src/3rdparty/harfbuzz-ng/src/hb-ot-os2-unicode-ranges.hh
@@ -33,22 +33,11 @@ namespace OT {
struct OS2Range
{
- static int
- cmp (const void *_key, const void *_item)
- {
- hb_codepoint_t cp = *((hb_codepoint_t *) _key);
- const OS2Range *range = (OS2Range *) _item;
+ int cmp (hb_codepoint_t key) const
+ { return (key < first) ? -1 : key <= last ? 0 : +1; }
- if (cp < range->start)
- return -1;
- else if (cp <= range->end)
- return 0;
- else
- return +1;
- }
-
- hb_codepoint_t start;
- hb_codepoint_t end;
+ hb_codepoint_t first;
+ hb_codepoint_t last;
unsigned int bit;
};
@@ -233,13 +222,8 @@ static const OS2Range _hb_os2_unicode_ranges[] =
static unsigned int
_hb_ot_os2_get_unicode_range_bit (hb_codepoint_t cp)
{
- OS2Range *range = (OS2Range*) hb_bsearch (&cp, _hb_os2_unicode_ranges,
- ARRAY_LENGTH (_hb_os2_unicode_ranges),
- sizeof (OS2Range),
- OS2Range::cmp);
- if (range != nullptr)
- return range->bit;
- return -1;
+ auto *range = hb_sorted_array (_hb_os2_unicode_ranges).bsearch (cp);
+ return range ? range->bit : (unsigned) -1;
}
} /* namespace OT */