[arrays] Change argument type of cmp called by hb_vector_t.bsearch()
Towards consolidating all array bsearch/...
This commit is contained in:
parent
5fdf7b724e
commit
22e1857b01
|
@ -77,9 +77,9 @@ struct hb_aat_map_builder_t
|
||||||
(a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0);
|
(a->seq < b->seq ? -1 : a->seq > b->seq ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int cmp (const short unsigned int *ty) const
|
int cmp (unsigned int ty) const
|
||||||
{
|
{
|
||||||
return (type != *ty) ? (type < *ty ? -1 : 1) : 0;
|
return (type != ty) ? (type < ty ? -1 : 1) : 0;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -57,8 +57,8 @@ struct hb_ot_map_t
|
||||||
unsigned int auto_zwj : 1;
|
unsigned int auto_zwj : 1;
|
||||||
unsigned int random : 1;
|
unsigned int random : 1;
|
||||||
|
|
||||||
inline int cmp (const hb_tag_t *tag_) const
|
inline int cmp (const hb_tag_t tag_) const
|
||||||
{ return *tag_ < tag ? -1 : *tag_ > tag ? 1 : 0; }
|
{ return tag_ < tag ? -1 : tag_ > tag ? 1 : 0; }
|
||||||
};
|
};
|
||||||
|
|
||||||
struct lookup_map_t {
|
struct lookup_map_t {
|
||||||
|
|
|
@ -45,7 +45,7 @@ struct hb_set_t
|
||||||
|
|
||||||
struct page_map_t
|
struct page_map_t
|
||||||
{
|
{
|
||||||
inline int cmp (const page_map_t *o) const { return (int) o->major - (int) major; }
|
inline int cmp (const page_map_t &o) const { return (int) o.major - (int) major; }
|
||||||
|
|
||||||
uint32_t major;
|
uint32_t major;
|
||||||
uint32_t index;
|
uint32_t index;
|
||||||
|
|
|
@ -267,7 +267,7 @@ struct hb_vector_t
|
||||||
while (min <= max)
|
while (min <= max)
|
||||||
{
|
{
|
||||||
int mid = ((unsigned int) min + (unsigned int) max) / 2;
|
int mid = ((unsigned int) min + (unsigned int) max) / 2;
|
||||||
int c = array[mid].cmp (&x);
|
int c = array[mid].cmp (x);
|
||||||
if (c < 0)
|
if (c < 0)
|
||||||
max = mid - 1;
|
max = mid - 1;
|
||||||
else if (c > 0)
|
else if (c > 0)
|
||||||
|
@ -281,7 +281,7 @@ struct hb_vector_t
|
||||||
}
|
}
|
||||||
if (i)
|
if (i)
|
||||||
{
|
{
|
||||||
if (max < 0 || (max < (int) this->len && array[max].cmp (&x) > 0))
|
if (max < 0 || (max < (int) this->len && array[max].cmp (x) > 0))
|
||||||
max++;
|
max++;
|
||||||
*i = max;
|
*i = max;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue