Conrad Sigona wrote:
>> 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.
> 

Hmmm at the very least it's confusing. He distinguishes the unaligned
and aligned encodings for integer12 but not for the others, the
implication being that they are the same with exception of padding bits.

integer8       C:00, C:01, C:10, C:11
integer9       C:00000010, C:00000110
integer10      C:P00000010, C:P00000110
integer11      C:P00000000 00000000, C:P01111001 00011000
integer12 (UNALIGNED) C:0 00000000 00000000,
                       C:0 00000001 00000000,
                       C:1 00000000 00000001
          (ALIGNED)    L:00 C:P00000000,
                       L:01 C:P00000001 00000000,
                       L:10 C:P00000001 00000000 00000001

By the way, I think it's a very good book.

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

A typo from me :-(

Thanks for your response, Dominic.

_______________________________________________
Asn1 mailing list
[email protected]
http://lists.asn1.org/mailman/listinfo/asn1

Reply via email to