Bit fields - (was Re: split into multiple topics - Re: [dfdl-wg] Issues: additional data types)

Robert E. McGrath mcgrath at ncsa.uiuc.edu
Tue Sep 6 16:17:28 CDT 2005


On Tuesday 06 September 2005 15:31, Mike Beckerle wrote:
> Bit fields issue.
>
> I have been expecting bit fields to work like this:
>
> <element name="threeBitField" type="xs:int" dfdl:length="3"
> dfdl:lengthUnitKind="bits"/>
>
> That is, bit fields are representational, but not part of the type system.
>
>
> Is this idea sufficient?
>
> Alternatively we could add a dfdl:bit type, which is a subtype of xs:byte
> having values only 0 and 1. Then you could do things like this:
>
> <element name="myBits" type="dfdl:bit" maxOccurs="3" minOccurs="3"
> dfdl:alignment="0"/>
>
> I put the alignment tag on to emphasize that there's no padding between
> the bits.
>

A tricky case:  bitfield across byte boundary.

  byte 0                       byte 1
  bit 0 1 2 3 4 5 6 7 8    0 1 2 3 4 5 6 7 
      |a a a| b b b b|c c   c c c| d | 0 0 0

 





More information about the dfdl-wg mailing list