[DFDL-WG] needed: signed bit fields

Steve Hanson smh at uk.ibm.com
Tue Dec 11 12:17:25 EST 2012


I believe the correct interpretation is 0 and -1. Not keen on 
re-interpreting this as 0 and 1. I am ok with a schema definition error. 

Regards

Steve Hanson
Architect, Data Format Description Language (DFDL)
Co-Chair, OGF DFDL Working Group
IBM SWG, Hursley, UK
smh at uk.ibm.com
tel:+44-1962-815848



From:   Mike Beckerle <mbeckerle.dfdl at gmail.com>
To:     Steve Hanson/UK/IBM at IBMGB, 
Cc:     dfdl-wg at ogf.org
Date:   11/12/2012 16:45
Subject:        Re: [DFDL-WG] needed: signed bit fields




Doesn't seem to say what happens if type is signed, but length in bits is 
1.

Can we make this an SDE please, since it can't be interpreted as a 
twos-complement integer? Alternatively, can we clarify that if the length 
is 1, the bit is interpreted as if there was a sign bit of 0?

When people write: <element name="myBit" type="xs:int" dfdl:length="1"/>

I am pretty sure they aren't expecting values of 0 or -1. They're 
expecting 0 or 1. 

...mikeb

On Tue, Dec 11, 2012 at 3:46 AM, Steve Hanson <smh at uk.ibm.com> wrote:
Errata 2.90. Sections 12.3, 12.3.7.2. Additionally allow lengthUnits 
'bits' to apply to binary signed integer types, to support the modeling of 
signed integer bit fields in the C language. The physical bits are 
interpreted as a two's complement integer. 

Regards

Steve Hanson
Architect, Data Format Description Language (DFDL)
Co-Chair, OGF DFDL Working Group
IBM SWG, Hursley, UK
smh at uk.ibm.com
tel:+44-1962-815848 



From:        Mike Beckerle <mbeckerle.dfdl at gmail.com> 
To:        dfdl-wg at ogf.org, 
Date:        10/12/2012 21:42 
Subject:        [DFDL-WG] needed: signed bit fields 
Sent by:        dfdl-wg-bounces at ogf.org 





current DFDL v1.0 spec says bit fields are all unsigned integers up to 
length 64. 

I am modeling data that uses lots of twos-complement 24-bit long and other 
length signed integers on various bit-boundaries. 

Was there a reason to leave signed twos-complement out for bit fields 
(other than perhaps just we thought we might get away with it?)

The only corner case I can think of is if you make a 1-bit wide signed bit 
field. This should be a Schema Defintion Error I believe, because 
twos-complement isn't defined unless you have at  one sign bit, and at 
least 1 mantissa bit. 

...mikeb


-- 
Mike Beckerle | OGF DFDL WG Co-Chair | Tresys Technologies
Tel:  781-330-0412

--
 dfdl-wg mailing list
 dfdl-wg at ogf.org
 https://www.ogf.org/mailman/listinfo/dfdl-wg 

Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU



-- 
Mike Beckerle | OGF DFDL WG Co-Chair | Tresys Technologies
Tel:  781-330-0412



Unless stated otherwise above:
IBM United Kingdom Limited - Registered in England and Wales with number 
741598. 
Registered office: PO Box 41, North Harbour, Portsmouth, Hampshire PO6 3AU
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.ogf.org/pipermail/dfdl-wg/attachments/20121211/a72100b6/attachment.html>


More information about the dfdl-wg mailing list