From f6ed1df62bd09758aebbaaeadf51041df1d62936 Mon Sep 17 00:00:00 2001 From: Justin Date: Sun, 14 Apr 2019 00:10:02 +1000 Subject: [PATCH] Update simple-serialize.md --- specs/simple-serialize.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/specs/simple-serialize.md b/specs/simple-serialize.md index 41999d1dc..ceb3652f3 100644 --- a/specs/simple-serialize.md +++ b/specs/simple-serialize.md @@ -76,11 +76,11 @@ return b"\x01" if value is True else b"\x00" ```python # Reccursively serialize fixed_parts = [serialize(element) if is_fixed_size(element) else None for element in value] -variable_parts = [serialize(element) if is_variable_size(element) else None for element in value] +variable_parts = [serialize(element) if is_variable_size(element) else "" for element in value] # Compute and check lengths fixed_lengths = [len(part) if part != None else BYTES_PER_LENGTH_OFFSET for part in fixed_parts] -variable_lengths = [len(part) if part != None else 0 for part in variable_parts] +variable_lengths = [len(part) for part in variable_parts] assert sum(fixed_lengths + variable_lengths) < 2**(BYTES_PER_LENGTH_OFFSET * BITS_PER_BYTE) # Compute offsets of variable-size parts and interleave offsets with fixed parts