fix whence=Head; position as 28 bits

This commit is contained in:
ariza 2020-02-19 13:20:29 -08:00
parent 4ca8e0d989
commit 1aed6d223c
1 changed files with 8 additions and 3 deletions

View File

@ -78,7 +78,7 @@ struct hb_serialize_context_t
bool is_wide: 1; bool is_wide: 1;
bool is_signed: 1; bool is_signed: 1;
whence_t whence: 2; whence_t whence: 2;
unsigned position: 29; unsigned position: 28;
unsigned bias; unsigned bias;
objidx_t objidx; objidx_t objidx;
}; };
@ -297,8 +297,13 @@ struct hb_serialize_context_t
link.position = (const char *) &ofs - current->head; link.position = (const char *) &ofs - current->head;
if (whence == Head) if (whence == Head)
{ {
assert (current->head <= (const char *)base); if (base == nullptr)
link.bias = (const char *) base - current->head; link.bias = 0;
else
{
assert (current->head <= (const char *)base);
link.bias = (const char *) base - current->head;
}
} }
else else
link.bias = 0; link.bias = 0;