From 3e86f27063912c48ef6c90bf2432a33e77685cb9 Mon Sep 17 00:00:00 2001 From: Peter Harpending Date: Sun, 23 Oct 2022 04:43:35 -0600 Subject: [PATCH] minor cleanups in rlp.erl --- bindings/typescript/test/testgen/rlp.erl | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/bindings/typescript/test/testgen/rlp.erl b/bindings/typescript/test/testgen/rlp.erl index b8cb503..7076267 100644 --- a/bindings/typescript/test/testgen/rlp.erl +++ b/bindings/typescript/test/testgen/rlp.erl @@ -38,7 +38,7 @@ encode_binary(Bytes) when byte_size(Bytes) =< 55 -> <<(128 + Size), Bytes/binary>>; % more than 55 bytes long, first byte is 183 + ByteLengthOfLength % max byte size is 2^64 - 1 -encode_binary(Bytes) when 55 =< byte_size(Bytes), byte_size(Bytes) < (1 bsl 64) -> +encode_binary(Bytes) when 55 < byte_size(Bytes), byte_size(Bytes) < (1 bsl 64) -> SizeInt = byte_size(Bytes), SizeBytes = binary:encode_unsigned(SizeInt, big), SizeOfSizeInt = byte_size(SizeBytes), @@ -66,8 +66,7 @@ encode_list(List) -> Payload_Size =< 55 -> <<(192 + Payload_Size), Payload/binary>>; 55 < Payload_Size -> - SizeInt = byte_size(Payload), - SizeBytes = binary:encode_unsigned(SizeInt, big), + SizeBytes = binary:encode_unsigned(Payload_Size, big), SizeOfSizeInt = byte_size(SizeBytes), %% 247 = 192 + 55 %% SizeOfSizeInt > 0