diff options
author | Gustav Simonsson <[email protected]> | 2012-08-15 18:05:09 +0200 |
---|---|---|
committer | Gustav Simonsson <[email protected]> | 2012-08-15 18:05:09 +0200 |
commit | e9e2383b18db83f796196ec8a4806ba49316e92d (patch) | |
tree | 81252f4f2874b2f443ba31ce4d902f82c22db463 /lib/asn1/src/asn1ct_gen_per.erl | |
parent | e7b55dfb9752a2282894b378f5a116cfe48a2405 (diff) | |
parent | f3c830eddc68d7269d4f48b13ddae40893929573 (diff) | |
download | otp-e9e2383b18db83f796196ec8a4806ba49316e92d.tar.gz otp-e9e2383b18db83f796196ec8a4806ba49316e92d.tar.bz2 otp-e9e2383b18db83f796196ec8a4806ba49316e92d.zip |
Merge branch 'maint'
Diffstat (limited to 'lib/asn1/src/asn1ct_gen_per.erl')
-rw-r--r-- | lib/asn1/src/asn1ct_gen_per.erl | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/lib/asn1/src/asn1ct_gen_per.erl b/lib/asn1/src/asn1ct_gen_per.erl index 5f42eacbdc..bd5b81991d 100644 --- a/lib/asn1/src/asn1ct_gen_per.erl +++ b/lib/asn1/src/asn1ct_gen_per.erl @@ -321,19 +321,13 @@ effective_constr(_,[]) -> []; effective_constr('SingleValue',List) -> SVList = lists:flatten(lists:map(fun(X)->element(2,X)end,List)), - % sort and remove duplicates - SortedSVList = lists:sort(SVList), - RemoveDup = fun([],_) ->[]; - ([H],_) -> [H]; - ([H,H|T],F) -> F([H|T],F); - ([H|T],F) -> [H|F(T,F)] - end, - - case RemoveDup(SortedSVList,RemoveDup) of + %% Sort and remove duplicates before generating SingleValue or ValueRange + %% In case of ValueRange, also check for 'MIN and 'MAX' + case lists:usort(SVList) of [N] -> [{'SingleValue',N}]; - L when is_list(L) -> - [{'ValueRange',{hd(L),lists:last(L)}}] + L when is_list(L) -> + [{'ValueRange',{least_Lb(L),greatest_Ub(L)}}] end; effective_constr('ValueRange',List) -> LBs = lists:map(fun({_,{Lb,_}})-> Lb end,List), |