diff options
author | Lukas Larsson <[email protected]> | 2011-07-14 16:18:08 +0200 |
---|---|---|
committer | Lukas Larsson <[email protected]> | 2011-07-21 14:50:21 +0200 |
commit | f1ed5142afc7198778df27c61db48ea0979f95e1 (patch) | |
tree | b6b6981b403c34d1b1e598d704c70a8ad6aa72d0 | |
parent | 9c2fe1e021747a0113bdba2172b71e91c4937f91 (diff) | |
download | otp-f1ed5142afc7198778df27c61db48ea0979f95e1.tar.gz otp-f1ed5142afc7198778df27c61db48ea0979f95e1.tar.bz2 otp-f1ed5142afc7198778df27c61db48ea0979f95e1.zip |
Use lists:mapfoldl instead for a tiny performance gain
-rw-r--r-- | lib/asn1/src/asn1rt_ber_bin_v2.erl | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/lib/asn1/src/asn1rt_ber_bin_v2.erl b/lib/asn1/src/asn1rt_ber_bin_v2.erl index a3bb570282..6947201167 100644 --- a/lib/asn1/src/asn1rt_ber_bin_v2.erl +++ b/lib/asn1/src/asn1rt_ber_bin_v2.erl @@ -1577,14 +1577,12 @@ e_object_identifier(V) when is_tuple(V) -> e_object_identifier([E1, E2 | Tail]) -> Head = 40*E1 + E2, % wow! {H,Lh} = mk_object_val(Head), - {R,Lr} = enc_obj_id_tail(Tail, [], 0), + {R,Lr} = lists:mapfoldl(fun enc_obj_id_tail/2,0,Tail), {[H|R], Lh+Lr}. -enc_obj_id_tail([], Ack, Len) -> - {lists:reverse(Ack), Len}; -enc_obj_id_tail([H|T], Ack, Len) -> +enc_obj_id_tail(H, Len) -> {B, L} = mk_object_val(H), - enc_obj_id_tail(T, [B|Ack], Len+L). + {B,Len+L}. %%%%%%%%%%% |