Hi,

    If you meant that the encoding should be packed, then this structure
when used with PER encoding rules will yield the most packed encoding. When
decoding, there is no packing to be considered since it depends on the data
structure used to represent (struct A). i.e. all that matters is that the C
structure is packed. In simple terms, decoding only populates the deciphered
data into the designated C structure. So the decoded value (instance of the
structure in which the deciphered value is populated) is as much packed as
the structure definitions is.

    We need understand the difference b/w the representation in memory and
the generated bit stream. The compiler has everything to do with the
representation in memory (instance of the structure). The most packed data
structure that the ASN.1 compiler in use can generate is as much as we can
get.

    And the encoding/decoding rules have to do everything with the generated
bit stream and decoding from the same only. Regardless of the way / data
structure in which the data is stored, the encoding will be the same (As
long as the ASN.1 specification does not change), and this is the core
principle of ASN.1.

Hope things are clear now.

Regards 
Ramaswamy R 

To deny our instincts, is to deny the very thing that makes us human - Mouse
(The Matrix)


-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Monday, May 31, 2004 11:37 AM
To: [EMAIL PROTECTED]
Subject: RE: [ASN.1] C bit fields representation in ASN.1

If the C structure was:

struct A
{
    unsigned a1:1;
    unsigned a2:3;
    unsigned a3:4;
    unsigned a4:2;
}

Can I use a bit string to represent those fields having more than one bit
representations, instead of boolean members as follows:

A ::= SEQUENCE
{
a1 BIT STRING(SIZE(1)),
a2 BIT STRING(SIZE(3)),
a3 BIT STRING(SIZE(4)),
a4 BIT STRING(SIZE(2))
}

Is there a better way to represent this?

How do I ensure that this data when decoded will result in a "packed"
structure ?

Thanks,
Aparna

Reply via email to