diff options
-rw-r--r-- | lib/asn1/src/asn1rt_per_bin.erl | 8 | ||||
-rw-r--r-- | lib/asn1/src/asn1rt_per_bin_rt2ct.erl | 8 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/asn1/src/asn1rt_per_bin.erl b/lib/asn1/src/asn1rt_per_bin.erl index 4e0c12936c..85988aa21d 100644 --- a/lib/asn1/src/asn1rt_per_bin.erl +++ b/lib/asn1/src/asn1rt_per_bin.erl @@ -695,10 +695,10 @@ encode_constrained_number({Lb,Ub},Val) when Val >= Lb, Ub >= Val -> Range =< 65536 -> {octets,<<Val2:16>>}; Range =< (1 bsl (255*8)) -> - Octs = binary:bin_to_list(binary:encode_unsigned(Val2)), - RangeOcts = binary:bin_to_list(binary:encode_unsigned(Range - 1)), - OctsLen = length(Octs), - RangeOctsLen = length(RangeOcts), + Octs = binary:encode_unsigned(Val2), + RangeOcts = binary:encode_unsigned(Range - 1), + OctsLen = erlang:byte_size(Octs), + RangeOctsLen = erlang:byte_size(RangeOcts), LengthBitsNeeded = minimum_bits(RangeOctsLen - 1), [{bits, LengthBitsNeeded, OctsLen - 1}, {octets, Octs}]; true -> diff --git a/lib/asn1/src/asn1rt_per_bin_rt2ct.erl b/lib/asn1/src/asn1rt_per_bin_rt2ct.erl index f2e93cf096..46d4bcb065 100644 --- a/lib/asn1/src/asn1rt_per_bin_rt2ct.erl +++ b/lib/asn1/src/asn1rt_per_bin_rt2ct.erl @@ -605,10 +605,10 @@ encode_constrained_number({Lb,Ub},Val) when Val >= Lb, Ub >= Val -> % Size = {octets,<<Val2:16>>}; [20,2,<<Val2:16>>]; Range =< (1 bsl (255*8)) -> - Octs = binary:bin_to_list(binary:encode_unsigned(Val2)), - RangeOcts = binary:bin_to_list(binary:encode_unsigned(Range - 1)), - OctsLen = length(Octs), - RangeOctsLen = length(RangeOcts), + Octs = binary:encode_unsigned(Val2), + RangeOcts = binary:encode_unsigned(Range - 1), + OctsLen = erlang:byte_size(Octs), + RangeOctsLen = erlang:byte_size(RangeOcts), LengthBitsNeeded = asn1rt_per_bin:minimum_bits(RangeOctsLen - 1), [10,LengthBitsNeeded,OctsLen-1,20,OctsLen,Octs]; true -> |