parent
b1dc676eaa
commit
39afe608b4
|
@ -758,6 +758,9 @@ struct PairValueRecord
|
||||||
{
|
{
|
||||||
friend struct PairSet;
|
friend struct PairSet;
|
||||||
|
|
||||||
|
int cmp (hb_codepoint_t k) const
|
||||||
|
{ return secondGlyph.cmp (k); }
|
||||||
|
|
||||||
bool serialize (hb_serialize_context_t *c,
|
bool serialize (hb_serialize_context_t *c,
|
||||||
unsigned length,
|
unsigned length,
|
||||||
const hb_map_t &glyph_map) const
|
const hb_map_t &glyph_map) const
|
||||||
|
@ -823,23 +826,11 @@ struct PairSet
|
||||||
unsigned int len2 = valueFormats[1].get_len ();
|
unsigned int len2 = valueFormats[1].get_len ();
|
||||||
unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2);
|
unsigned int record_size = HBUINT16::static_size * (1 + len1 + len2);
|
||||||
|
|
||||||
unsigned int count = len;
|
const PairValueRecord *record = hb_bsearch (buffer->info[pos].codepoint,
|
||||||
|
&firstPairValueRecord,
|
||||||
/* Hand-coded bsearch. */
|
len,
|
||||||
if (unlikely (!count))
|
record_size);
|
||||||
return_trace (false);
|
if (record)
|
||||||
hb_codepoint_t x = buffer->info[pos].codepoint;
|
|
||||||
int min = 0, max = (int) count - 1;
|
|
||||||
while (min <= max)
|
|
||||||
{
|
|
||||||
int mid = ((unsigned int) min + (unsigned int) max) / 2;
|
|
||||||
const PairValueRecord *record = &StructAtOffset<PairValueRecord> (&firstPairValueRecord, record_size * mid);
|
|
||||||
hb_codepoint_t mid_x = record->secondGlyph;
|
|
||||||
if (x < mid_x)
|
|
||||||
max = mid - 1;
|
|
||||||
else if (x > mid_x)
|
|
||||||
min = mid + 1;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
/* Note the intentional use of "|" instead of short-circuit "||". */
|
/* Note the intentional use of "|" instead of short-circuit "||". */
|
||||||
if (valueFormats[0].apply_value (c, this, &record->values[0], buffer->cur_pos()) |
|
if (valueFormats[0].apply_value (c, this, &record->values[0], buffer->cur_pos()) |
|
||||||
|
@ -850,8 +841,6 @@ struct PairSet
|
||||||
buffer->idx = pos;
|
buffer->idx = pos;
|
||||||
return_trace (true);
|
return_trace (true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue