skip previously parsed input in cache hit case
This commit is contained in:
parent
7678e8dd68
commit
5668b46f97
1 changed files with 8 additions and 1 deletions
|
|
@ -208,7 +208,14 @@ HParseResult* h_do_parse(const HParser* parser, HParseState *state) {
|
|||
setupLR(parser, state, m->left);
|
||||
return m->left->seed; // BUG: this might not be correct
|
||||
} else {
|
||||
return m->right;
|
||||
HParseResult *res = m->right;
|
||||
|
||||
// skip over the previously-parsed input
|
||||
long long offs = res->bit_length + state->input_stream.bit_offset;
|
||||
state->input_stream.index += offs >> 3;
|
||||
state->input_stream.bit_offset = offs & 7;
|
||||
|
||||
return res;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue