[constexpr] Use initializer instead of assignment

This commit is contained in:
Behdad Esfahbod 2021-02-22 22:28:32 -07:00
parent cc16b26ef4
commit f4f35a4d5f
2 changed files with 3 additions and 10 deletions

View File

@ -1821,8 +1821,7 @@ struct ClassDefFormat1
} }
/* TODO Speed up, using set overlap first? */ /* TODO Speed up, using set overlap first? */
/* TODO(iter) Rewrite as dagger. */ /* TODO(iter) Rewrite as dagger. */
HBUINT16 k; /* TODO(constexpr) use constructor to initialize. */ HBUINT16 k {klass};
k = klass;
const HBUINT16 *arr = classValue.arrayZ; const HBUINT16 *arr = classValue.arrayZ;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
if (arr[i] == k && glyphs->has (startGlyph + i)) if (arr[i] == k && glyphs->has (startGlyph + i))
@ -1995,8 +1994,7 @@ struct ClassDefFormat2
} }
/* TODO Speed up, using set overlap first? */ /* TODO Speed up, using set overlap first? */
/* TODO(iter) Rewrite as dagger. */ /* TODO(iter) Rewrite as dagger. */
HBUINT16 k; /* TODO(constexpr) use constructor to initialize. */ HBUINT16 k {klass};
k = klass;
const RangeRecord *arr = rangeRecord.arrayZ; const RangeRecord *arr = rangeRecord.arrayZ;
for (unsigned int i = 0; i < count; i++) for (unsigned int i = 0; i < count; i++)
if (arr[i].value == k && arr[i].intersects (glyphs)) if (arr[i].value == k && arr[i].intersects (glyphs))

View File

@ -2323,12 +2323,7 @@ struct ChainRule
{ {
c->copy (len); c->copy (len);
for (const auto g : it) for (const auto g : it)
{ c->copy (HBUINT16 {g});
/* TODO(constexpr) Simplify. */
HBUINT16 gid;
gid = g;
c->copy (gid);
}
} }
ChainRule* copy (hb_serialize_context_t *c, ChainRule* copy (hb_serialize_context_t *c,