diff --git a/src/hb-aat-layout.cc b/src/hb-aat-layout.cc index 6d93f1efa..fa1048e18 100644 --- a/src/hb-aat-layout.cc +++ b/src/hb-aat-layout.cc @@ -172,7 +172,7 @@ static const hb_aat_feature_mapping_t feature_mappings[] = const hb_aat_feature_mapping_t * hb_aat_layout_find_feature_mapping (hb_tag_t tag) { - return hb_bsearch (tag, feature_mappings, ARRAY_LENGTH (feature_mappings)); + return hb_sorted_array (feature_mappings).bsearch (tag); } #endif diff --git a/src/hb-ot-cff1-table.cc b/src/hb-ot-cff1-table.cc index 6a5bac000..66b9c8c90 100644 --- a/src/hb-ot-cff1-table.cc +++ b/src/hb-ot-cff1-table.cc @@ -247,13 +247,13 @@ hb_codepoint_t OT::cff1::lookup_expert_subset_charset_for_sid (hb_codepoint_t gl hb_codepoint_t OT::cff1::lookup_expert_charset_for_glyph (hb_codepoint_t sid) { - const auto *pair = hb_bsearch (sid, expert_charset_sid_to_gid, ARRAY_LENGTH (expert_charset_sid_to_gid)); + const auto *pair = hb_sorted_array (expert_charset_sid_to_gid).bsearch (sid); return pair ? pair->gid : 0; } hb_codepoint_t OT::cff1::lookup_expert_subset_charset_for_glyph (hb_codepoint_t sid) { - const auto *pair = hb_bsearch (sid, expert_subset_charset_sid_to_gid, ARRAY_LENGTH (expert_subset_charset_sid_to_gid)); + const auto *pair = hb_sorted_array (expert_subset_charset_sid_to_gid).bsearch (sid); return pair ? pair->gid : 0; } diff --git a/src/hb-ot-os2-unicode-ranges.hh b/src/hb-ot-os2-unicode-ranges.hh index fd432edd6..a592e9663 100644 --- a/src/hb-ot-os2-unicode-ranges.hh +++ b/src/hb-ot-os2-unicode-ranges.hh @@ -222,10 +222,9 @@ static const OS2Range _hb_os2_unicode_ranges[] = static unsigned int _hb_ot_os2_get_unicode_range_bit (hb_codepoint_t cp) { - auto* range = hb_bsearch (cp, _hb_os2_unicode_ranges, ARRAY_LENGTH (_hb_os2_unicode_ranges)); - if (range != nullptr) - return range->bit; - return -1; + auto *range = hb_sorted_array (_hb_os2_unicode_ranges).bsearch (cp); + if (unlikely (range == nullptr)) return -1; + return range->bit; } } /* namespace OT */