[vector/array] Simplify qsort()
This commit is contained in:
parent
1610008e62
commit
c7d57dcf26
|
@ -194,13 +194,6 @@ struct hb_array_t : hb_iter_with_fallback_t<hb_array_t<Type>, Type&>
|
|||
hb_qsort (arrayZ, length, this->get_item_size (), Type::cmp);
|
||||
return hb_sorted_array_t<Type> (*this);
|
||||
}
|
||||
void qsort (unsigned int start, unsigned int end)
|
||||
{
|
||||
end = hb_min (end, length);
|
||||
assert (start <= end);
|
||||
if (likely (start < end))
|
||||
hb_qsort (arrayZ + start, end - start, this->get_item_size (), Type::cmp);
|
||||
}
|
||||
|
||||
/*
|
||||
* Other methods.
|
||||
|
|
|
@ -667,8 +667,8 @@ struct ArrayOf
|
|||
unsigned int to_store = (unsigned int) -1) const
|
||||
{ return as_array ().lfind (x, i, not_found, to_store); }
|
||||
|
||||
void qsort (unsigned int start = 0, unsigned int end = (unsigned int) -1)
|
||||
{ as_array ().qsort (start, end); }
|
||||
void qsort ()
|
||||
{ as_array ().qsort (); }
|
||||
|
||||
HB_NODISCARD bool serialize (hb_serialize_context_t *c, unsigned items_len)
|
||||
{
|
||||
|
|
|
@ -343,7 +343,7 @@ hb_ot_map_builder_t::compile (hb_ot_map_t &m,
|
|||
/* Sort lookups and merge duplicates */
|
||||
if (last_num_lookups < m.lookups[table_index].length)
|
||||
{
|
||||
m.lookups[table_index].qsort (last_num_lookups, m.lookups[table_index].length);
|
||||
m.lookups[table_index].sub_array (last_num_lookups, m.lookups[table_index].length - last_num_lookups).qsort ();
|
||||
|
||||
unsigned int j = last_num_lookups;
|
||||
for (unsigned int i = j + 1; i < m.lookups[table_index].length; i++)
|
||||
|
|
|
@ -425,10 +425,8 @@ struct hb_vector_t
|
|||
|
||||
|
||||
/* Sorting API. */
|
||||
void qsort (int (*cmp)(const void*, const void*))
|
||||
void qsort (int (*cmp)(const void*, const void*) = Type::cmp)
|
||||
{ as_array ().qsort (cmp); }
|
||||
void qsort (unsigned int start = 0, unsigned int end = (unsigned int) -1)
|
||||
{ as_array ().qsort (start, end); }
|
||||
|
||||
/* Unsorted search API. */
|
||||
template <typename T>
|
||||
|
|
Loading…
Reference in New Issue