aboutsummaryrefslogtreecommitdiffstats
path: root/lib/asn1/src
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2013-02-22 15:57:04 +0100
committerBjörn Gustavsson <[email protected]>2013-05-31 14:52:14 +0200
commitbf3cce888ad50e19e260a7aab76a58d49f4fdf8b (patch)
tree3ed7c437bce2196f1e82bb048b41aab09e99c421 /lib/asn1/src
parent002d26b4660cf14509ea6848b9260014ae5960c6 (diff)
downloadotp-bf3cce888ad50e19e260a7aab76a58d49f4fdf8b.tar.gz
otp-bf3cce888ad50e19e260a7aab76a58d49f4fdf8b.tar.bz2
otp-bf3cce888ad50e19e260a7aab76a58d49f4fdf8b.zip
asn1ct_constructed_per: Optimize decoding of OPTIONAL
Diffstat (limited to 'lib/asn1/src')
-rw-r--r--lib/asn1/src/asn1ct_constructed_per.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/asn1/src/asn1ct_constructed_per.erl b/lib/asn1/src/asn1ct_constructed_per.erl
index bcc5aee8bb..02947ed6ea 100644
--- a/lib/asn1/src/asn1ct_constructed_per.erl
+++ b/lib/asn1/src/asn1ct_constructed_per.erl
@@ -1248,11 +1248,15 @@ comp_call_pre_post(noext, mandatory, _, _, _, _, _, _) ->
comp_call_pre_post(noext, Prop, _, _, TextPos, OptTable, NumOptionals, Ext) ->
%% OPTIONAL or DEFAULT
OptPos = get_optionality_pos(TextPos, OptTable),
- Element = io_lib:format("Opt band (1 bsl ~w)",
- [NumOptionals - OptPos]),
+ Element = case NumOptionals - OptPos of
+ 0 ->
+ "Opt band 1";
+ Shift ->
+ lists:concat(["(Opt bsr ",Shift,") band 1"])
+ end,
{[fun(St) ->
emit(["case ",Element," of",nl,
- " _Opt",TextPos," when _Opt",TextPos," > 0 ->"]),
+ "1 ->",nl]),
St
end],
[fun(St) ->