diff options
author | Björn Gustavsson <[email protected]> | 2012-11-14 08:54:03 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2012-11-23 11:44:04 +0100 |
commit | 604c0ff955a9fb6d9055fec98cbafe8496c81936 (patch) | |
tree | 19f54695202ab925b89c3b1c6ef112ff87f6b0f9 /lib/asn1/src/asn1rt_per_bin_rt2ct.erl | |
parent | 59f801110d97ce6f6d86a1be8fb57392e70c4dd3 (diff) | |
download | otp-604c0ff955a9fb6d9055fec98cbafe8496c81936.tar.gz otp-604c0ff955a9fb6d9055fec98cbafe8496c81936.tar.bz2 otp-604c0ff955a9fb6d9055fec98cbafe8496c81936.zip |
Remove the unused asn1ct_per_bin module
Diffstat (limited to 'lib/asn1/src/asn1rt_per_bin_rt2ct.erl')
-rw-r--r-- | lib/asn1/src/asn1rt_per_bin_rt2ct.erl | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/asn1/src/asn1rt_per_bin_rt2ct.erl b/lib/asn1/src/asn1rt_per_bin_rt2ct.erl index 290054b4dc..01e1cb23d7 100644 --- a/lib/asn1/src/asn1rt_per_bin_rt2ct.erl +++ b/lib/asn1/src/asn1rt_per_bin_rt2ct.erl @@ -597,7 +597,7 @@ encode_constrained_number({Lb,Ub},Val) when Val >= Lb, Ub >= Val -> RangeOcts = binary:encode_unsigned(Range - 1), OctsLen = erlang:byte_size(Octs), RangeOctsLen = erlang:byte_size(RangeOcts), - LengthBitsNeeded = asn1rt_per_bin:minimum_bits(RangeOctsLen - 1), + LengthBitsNeeded = minimum_bits(RangeOctsLen - 1), [10,LengthBitsNeeded,OctsLen-1,20,OctsLen,Octs]; true -> exit({not_supported,{integer_range,Range}}) @@ -653,6 +653,16 @@ decode_constrained_number(Buffer,{Lb,_Ub},Range) -> end, {Val+Lb,Remain}. +%% For some reason the minimum bits needed in the length field in +%% the encoding of constrained whole numbers must always be at least 2? +minimum_bits(N) when N < 4 -> 2; +minimum_bits(N) when N < 8 -> 3; +minimum_bits(N) when N < 16 -> 4; +minimum_bits(N) when N < 32 -> 5; +minimum_bits(N) when N < 64 -> 6; +minimum_bits(N) when N < 128 -> 7; +minimum_bits(_N) -> 8. + %% X.691:10.8 Encoding of an unconstrained whole number encode_unconstrained_number(Val) when Val >= 0 -> |