Update simple-serialize.md

This commit is contained in:
Justin 2019-04-14 00:05:43 +10:00 committed by GitHub
parent a90bcc0cd4
commit 23c09541e2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -83,7 +83,7 @@ fixed_lengths = [len(part) if part != None else BYTES_PER_LENGTH_OFFSET for part
variable_lengths = [len(part) if part != None else 0 for part in variable_parts]
assert sum(fixed_lengths + variable_lengths) < 2**(BYTES_PER_LENGTH_OFFSET * BITS_PER_BYTE)
# Compute offsets of variable-size elements, and interleave with fixed parts
# Compute offsets of variable-size parts and interleave offsets with fixed parts
offsets = [sum(fixed_lengths + variable_lengths[:i]) for i in range(len(value))]
fixed_parts = [part if part != None else offsets[i] for i, part in enumerate(fixed_parts)]