aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-11-22 14:56:30 +0100
committerBjörn Gustavsson <[email protected]>2014-01-20 12:22:41 +0100
commitc8266f4dcbafe0afdf291cb562605e968f778f14 (patch)
tree56dffe9371abee937efd58c181ecd636de2252ee /lib/asn1
parent252bad05df875934edce64326e8ff204062aa7c7 (diff)
downloadotp-c8266f4dcbafe0afdf291cb562605e968f778f14.tar.gz
otp-c8266f4dcbafe0afdf291cb562605e968f778f14.tar.bz2
otp-c8266f4dcbafe0afdf291cb562605e968f778f14.zip
Improve construction of {cons,H,T} instructions
Make sure that we don't construct: {cons,{integer,I},{cons,{binary,B},T}} - OR - {cons,{binary,B},{cons,{integer,I},T}} but: {cons,{binary,[{put_bits,I,8,[1]}|B]},T} - OR - {cons,{binary,B++[{put_bits,I,8,[1]}]},T}
Diffstat (limited to 'lib/asn1')
-rw-r--r--lib/asn1/src/asn1ct_imm.erl6
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/asn1/src/asn1ct_imm.erl b/lib/asn1/src/asn1ct_imm.erl
index 047156fc10..7b352c7872 100644
--- a/lib/asn1/src/asn1ct_imm.erl
+++ b/lib/asn1/src/asn1ct_imm.erl
@@ -1662,9 +1662,13 @@ enc_pre_cg_2({var,_}=Imm, _, _) -> Imm.
enc_make_cons({binary,H}, {binary,T}) ->
{binary,H++T};
enc_make_cons({binary,H0}, {cons,{binary,H1},T}) ->
- {cons,{binary,H0++H1},T};
+ enc_make_cons({binary,H0++H1}, T);
+enc_make_cons({binary,H}, {cons,{integer,Int},T}) ->
+ enc_make_cons({binary,H++[{put_bits,Int,8,[1]}]}, T);
enc_make_cons({integer,Int}, {binary,T}) ->
{binary,[{put_bits,Int,8,[1]}|T]};
+enc_make_cons({integer,Int}, {cons,{binary,H},T}) ->
+ enc_make_cons({binary,[{put_bits,Int,8,[1]}|H]}, T);
enc_make_cons(H, T) ->
{cons,H,T}.