LiteralIndex litIdx = *i;
// Write LitInfo header.
- u8 *oldPtr = ptr;
LitInfo &finalLI = *(LitInfo *)ptr;
finalLI = tmpLitInfo[litIdx];
ptr += sizeof(LitInfo); // String starts directly after LitInfo.
-
- // Write literal prefix (everything before the last N characters,
- // as the last N are already confirmed).
- const string &t = lits[litIdx].s;
- if (t.size() > sizeof(CONF_TYPE)) {
- size_t prefix_len = t.size() - sizeof(CONF_TYPE);
- memcpy(ptr, t.c_str(), prefix_len);
- ptr += prefix_len;
- }
-
- ptr = ROUNDUP_PTR(ptr, alignof(LitInfo));
+ assert(lits[litIdx].s.size() <= sizeof(CONF_TYPE));
if (next(i) == e) {
finalLI.next = 0;
} else {
- // our next field represents an adjustment on top of
- // current address + the actual size of the literal
- // so we track any rounding up done for alignment and
- // add this in - that way we don't have to use bigger
- // than a u8 (for now)
- assert((size_t)(ptr - oldPtr) > t.size());
- finalLI.next = verify_u8(ptr - oldPtr - t.size());
+ finalLI.next = 1;
}
}
assert((size_t)(ptr - fdrc_base) <= size);
*control = a->cb(loc - buf, i, li->id, a->ctxt);
out:
oldNext = li->next; // oldNext is either 0 or an 'adjust' value
- li = (const struct LitInfo *)((const u8 *)li + oldNext + li->size);
+ li++;
} while (oldNext);
}