Description
Implement the binaryNumberRep 'offsetBinary'.
This is a good first project for someone new to the Daffodil code base.
This is a proposal for inclusion in the DFDL language, needed for some formats such as STANAG 5516.
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.
The DFDL spec would change so table 13.7 allows 'offsetBinary' for the signed integer types.
The lengthKind would have to be implicit or explicit. (SDE otherwise).