By default, variant does not skip the kind, see #78.
For example:
variant UnsignedNumber
{
case 0x18:
case 0x11:
UnsignedLong;
case 0x04:
case 0x01:
case 0x00:
UnsignedInteger;
}
variant UnsignedLong of uint64
{
case 0x18: uint64;
case 0x11: uint8;
}
variant UnsignedInteger of uint32
{
case 0x04: uint32;
case 0x01: uint8;
case 0x00: 0;
}
Add support to skip the case kind when needed by adding + to the kind type.
variant Descriptor switch (uint8+) as uint64
{
case 0x00: UnsignedLong;
}
The generated code for Descriptor above is almost identical to that without the + except that the uint8 byte used for the case is skipped during flyweight read, and filled in implicitly during flyweight builder write.
By default,
variant
does not skip the kind, see #78.For example:
Add support to skip the case
kind
when needed by adding+
to thekind
type.variant Descriptor switch (uint8+) as uint64 { case 0x00: UnsignedLong; }
The generated code for
Descriptor
above is almost identical to that without the+
except that theuint8
byte used for the case is skipped during flyweight read, and filled in implicitly during flyweight builder write.