Hi,

As per X.691 clause 12, Note 1 ("Ranges which allow encoding of all values
into two octets go into two octets in an 
octet-aligned bit-field with no length count."), for the specified range, 16
bits are required i.e. 2 octets. Thus the second encoding that you mentioned
would be correct. As the same note explains the Length Determinant is
applicable when more than 2 octets are required.

A Size Constraint is not applicable for INTEGER Type. X.680-0207 clearly
explains the applicability of SIZE Constraint under the clause - 47.5.2.

Hope the clarifies things for you.

Regards 
Ramaswamy R 
HCL Technologies Ltd,VPLN,Chennai
Ph (Off) : 23728366 ext 2344 

"Do or do not. There is no try." - Yoda

Disclaimer: 

This message and any attachment(s) contained here are information that is
confidential, proprietary to HCL Technologies and its customers. Contents
may be privileged or otherwise protected by law. The information is solely
intended for the individual or the entity it is addressed to. If you are not
the intended recipient of this message, you are not authorized to read,
forward, print, retain, copy or disseminate this message or any part of it.
If you have received this e-mail in error, please notify the sender
immediately by return e-mail and delete it from your computer.



-----Original Message-----
From: Bjoern Schneider [mailto:[EMAIL PROTECTED]
Sent: Tuesday, August 31, 2004 2:25 PM
To: [EMAIL PROTECTED]
Subject: [ASN1] INTEGER encoding in PER


Hi,

I'm curious about the following 'problem' (actually, I couldn't 
understand ITUs recommendation X.691 fully... o_O ):

SomeInt ::= INTEGER (0..65535)

a SomeInt ::= 10
b SomeInt ::= 32000

Now, when I encode these two variables into _byte-aligned_ PER: has 
there to be a length part everytime? i.e.:

   -- a:
     00000001 00001010
   -- b:
     00000010 01111101 00000000

Or will it encoded as 2-byte number? i.e.:

   -- a:
     00000000 00001010
   -- b:
     01111101 00000000

Although I'd rather like to use the last one, I think it has to be 
encoded like the first example, with lengths... or is it possible to 
force a 2-byte value explicitely? Maybe with the SIZE(2)-constraint, so 
that you can omit the length? As I tried something like this the last 
time, my compiler bailed out with a syntax error, and I think he's 
(unfortunately ;) ) right...

Thanks in advance,
   Bjoern Schneider




_______________________________________________
ASN1 mailing list
[EMAIL PROTECTED]
http://lists.asn1.org/mailman/listinfo/asn1
_______________________________________________
ASN1 mailing list
[EMAIL PROTECTED]
http://lists.asn1.org/mailman/listinfo/asn1

Reply via email to