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
|
||||||
|
@ -814,8 +817,8 @@ struct PairSet
|
||||||
}
|
}
|
||||||
|
|
||||||
bool apply (hb_ot_apply_context_t *c,
|
bool apply (hb_ot_apply_context_t *c,
|
||||||
const ValueFormat *valueFormats,
|
const ValueFormat *valueFormats,
|
||||||
unsigned int pos) const
|
unsigned int pos) const
|
||||||
{
|
{
|
||||||
TRACE_APPLY (this);
|
TRACE_APPLY (this);
|
||||||
hb_buffer_t *buffer = c->buffer;
|
hb_buffer_t *buffer = c->buffer;
|
||||||
|
@ -823,35 +826,21 @@ 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;
|
/* Note the intentional use of "|" instead of short-circuit "||". */
|
||||||
const PairValueRecord *record = &StructAtOffset<PairValueRecord> (&firstPairValueRecord, record_size * mid);
|
if (valueFormats[0].apply_value (c, this, &record->values[0], buffer->cur_pos()) |
|
||||||
hb_codepoint_t mid_x = record->secondGlyph;
|
valueFormats[1].apply_value (c, this, &record->values[len1], buffer->pos[pos]))
|
||||||
if (x < mid_x)
|
buffer->unsafe_to_break (buffer->idx, pos + 1);
|
||||||
max = mid - 1;
|
if (len2)
|
||||||
else if (x > mid_x)
|
pos++;
|
||||||
min = mid + 1;
|
buffer->idx = pos;
|
||||||
else
|
return_trace (true);
|
||||||
{
|
|
||||||
/* Note the intentional use of "|" instead of short-circuit "||". */
|
|
||||||
if (valueFormats[0].apply_value (c, this, &record->values[0], buffer->cur_pos()) |
|
|
||||||
valueFormats[1].apply_value (c, this, &record->values[len1], buffer->pos[pos]))
|
|
||||||
buffer->unsafe_to_break (buffer->idx, pos + 1);
|
|
||||||
if (len2)
|
|
||||||
pos++;
|
|
||||||
buffer->idx = pos;
|
|
||||||
return_trace (true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return_trace (false);
|
return_trace (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue