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

-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Sent: Saturday, May 29, 2004 5:40 AM
To: Aparna Kailas (WT01 - EMBEDDED & PRODUCT ENGINEERING SOLUTIONS)
Cc: [EMAIL PROTECTED]
Subject: Re: [ASN.1] C bit fields representation in ASN.1


> How would I be able to represent the following in ASN.1 ?
> C structure:

> struct A
> {
>     unsigned a1:1;
>     unsigned a2:1;
>     unsigned a3:1;
>     unsigned a4:1;
> }

A ::= SEQUENCE
{
a1 BOOL,
a2 BOOL,
a3 BOOL,
a4 BOOL
}

> Will the encoding in ASN.1 use any optimization techniques for
> instance representing the struct in a single byte ?

If you use PER, yes.

Saludos,
                                        HoraPe
---
Horacio J. Peņa
[EMAIL PROTECTED]
[EMAIL PROTECTED]

Confidentiality Notice

The information contained in this electronic message and any attachments to this 
message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged 
information. If
you are not the intended recipient, please notify the sender at Wipro or [EMAIL 
PROTECTED] immediately
and destroy all copies of this message and any attachments.

Reply via email to