In Section 11.3 Constrained integer types, Larmouth gives an example PER
encoding:

integer11 INTEGER (0..32000) ::= 0, 31000

integer11 C:P00000000 00000000, C:P01111001 00011000

However referring to the standard:

10.5.6 In the case of the UNALIGNED variant the value ("n" ÿÿ "lb") shall
be encoded as a non-negative-binary-integer in a bit-field as specified
in 10.3 with the minimum number of bits necessary to represent the range.
  NOTE ÿÿ If "range" satisfies the inequality 2^m < "range" ÿÿ 2^(m + 1),
then the number of bits = m + 1.

2^14 (=16384) < 32000 - 0 + 1 ÿÿ 2^15 (=32768) and so the minimum number
of bits is 15 (not 16) and therefore the encodings should be

integer11 C:P0000000 00000000, C:P1111001 00011000

I've checked this with asn1c and it agrees with my reasoning.

I believe Prof Larmouth was exhibiting an example of aligned PER.

For aligned PER, P01111001 00011000 is correct.

For unaligned PER, 1111001 00011000 is correct. Note that there is no padding (no P).


=====================================================================
Conrad Sigona                    Voice Mail     : 1-732-302-9669 x400
OSS Nokalva                      Fax            : 1-614-388-4156
[EMAIL PROTECTED]                   My direct line : 1-315-845-1773
_______________________________________________
Asn1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1

Reply via email to