We have found a number of places that use offset-binary numeric representation. This is also called excess-K, or biased, but I think offset binary is a better description of it.

In this representation you take an unsigned binary, and just subtract an offset. E.g., for a 3-bit number, mostSignificantBitFirst:

bits    unsigned  twos-comp  offsetBinary

000       0         0          -4
001       1         1          -3
010       2         2          -2
011       3         3          -1
100       4        -4           0
101       5        -3           1
110       6        -2           2
111       7        -1           3        

At the moment, users have to work around this in Daffodil using inputValueCalc and outputValueCalc. This is feasible, but really awkward for such a simple concept.

So we suggest that the next revision of DFDL include dfdl:binaryNumberRep="offsetBinary"

Thoughts?

...mikeb

Mike Beckerle | OGF DFDL Workgroup Co-Chair | Tresys Technology | www.tresys.com
Please note: Contributions to the DFDL Workgroup's email discussions are subject to the OGF Intellectual Property Policy