[skippy-iter] Remove early stop

The optimization in (Chain)RuleSet matching relies on
matching one, even if num_items is out of range.

Fixes https://github.com/harfbuzz/harfbuzz/issues/4358
This commit is contained in:
Behdad Esfahbod committed 2023-08-01 19:41:12 -06:00
1 parent 70b3fbed28
commit 39048099cb
1 file changed
+2 -10
+2 -10
View File
@@ -584,11 +584,7 @@ struct hb_ot_apply_context_t :
bool next (unsigned *unsafe_to = nullptr)
{
assert (num_items > 0);
/* The alternate condition below is faster at string boundaries,
* but produces subpar "unsafe-to-concat" values. */
signed stop = (signed) end - (signed) num_items;
if (c->buffer->flags & HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT)
stop = (signed) end - 1;
const signed stop = (signed) end - 1;
while ((signed) idx < stop)
{
idx++;
@@ -620,11 +616,7 @@ struct hb_ot_apply_context_t :
bool prev (unsigned *unsafe_from = nullptr)
{
assert (num_items > 0);
/* The alternate condition below is faster at string boundaries,
* but produces subpar "unsafe-to-concat" values. */
unsigned stop = num_items - 1;
if (c->buffer->flags & HB_BUFFER_FLAG_PRODUCE_UNSAFE_TO_CONCAT)
stop = 1 - 1;
const unsigned stop = 0;
while (idx > stop)
{
idx--;