message-size-increase #3
@ -307,8 +307,8 @@ func (this *Generator) generateMessage(method uint16, message Message) (n int, e
|
|||||||
func (this *Generator) generateEncodeValue(typ Type, valueSource, tagSource string) (n int, err error) {
|
func (this *Generator) generateEncodeValue(typ Type, valueSource, tagSource string) (n int, err error) {
|
||||||
switch typ := typ.(type) {
|
switch typ := typ.(type) {
|
||||||
case TypeInt:
|
case TypeInt:
|
||||||
// SI: (none)
|
// SI: (none)
|
||||||
// LI: <value: IntN>
|
// LI/LSI: <value: IntN>
|
||||||
if typ.Bits <= 5 {
|
if typ.Bits <= 5 {
|
||||||
// SI stores the value in the tag, so we write nothing here
|
// SI stores the value in the tag, so we write nothing here
|
||||||
break
|
break
|
||||||
@ -478,8 +478,8 @@ func (this *Generator) generateEncodeValue(typ Type, valueSource, tagSource stri
|
|||||||
func (this *Generator) generateDecodeValue(typ Type, typeName, valueSource, tagSource string) (n int, err error) {
|
func (this *Generator) generateDecodeValue(typ Type, typeName, valueSource, tagSource string) (n int, err error) {
|
||||||
switch typ := typ.(type) {
|
switch typ := typ.(type) {
|
||||||
case TypeInt:
|
case TypeInt:
|
||||||
// SI: (none)
|
// SI: (none)
|
||||||
// LI: <value: IntN>
|
// LI/LSI: <value: IntN>
|
||||||
if typ.Bits <= 5 {
|
if typ.Bits <= 5 {
|
||||||
// SI stores the value in the tag
|
// SI stores the value in the tag
|
||||||
nn, err := this.iprintf("*%s = uint8(%s.CN())\n", valueSource, tagSource)
|
nn, err := this.iprintf("*%s = uint8(%s.CN())\n", valueSource, tagSource)
|
||||||
@ -837,6 +837,9 @@ func (this *Generator) generateTag(typ Type, source string) (n int, err error) {
|
|||||||
if typ.Bits <= 5 {
|
if typ.Bits <= 5 {
|
||||||
nn, err := this.printf("tape.SI.WithCN(int(%s))", source)
|
nn, err := this.printf("tape.SI.WithCN(int(%s))", source)
|
||||||
n += nn; if err != nil { return n, err }
|
n += nn; if err != nil { return n, err }
|
||||||
|
} else if typ.Signed {
|
||||||
|
nn, err := this.printf("tape.LSI.WithCN(%d)", bitsToCN(typ.Bits))
|
||||||
|
n += nn; if err != nil { return n, err }
|
||||||
} else {
|
} else {
|
||||||
nn, err := this.printf("tape.LI.WithCN(%d)", bitsToCN(typ.Bits))
|
nn, err := this.printf("tape.LI.WithCN(%d)", bitsToCN(typ.Bits))
|
||||||
n += nn; if err != nil { return n, err }
|
n += nn; if err != nil { return n, err }
|
||||||
@ -881,6 +884,9 @@ func (this *Generator) generateTN(typ Type) (n int, err error) {
|
|||||||
if typ.Bits <= 5 {
|
if typ.Bits <= 5 {
|
||||||
nn, err := this.printf("tape.SI")
|
nn, err := this.printf("tape.SI")
|
||||||
n += nn; if err != nil { return n, err }
|
n += nn; if err != nil { return n, err }
|
||||||
|
} else if typ.Signed {
|
||||||
|
nn, err := this.printf("tape.LSI")
|
||||||
|
n += nn; if err != nil { return n, err }
|
||||||
} else {
|
} else {
|
||||||
nn, err := this.printf("tape.LI")
|
nn, err := this.printf("tape.LI")
|
||||||
n += nn; if err != nil { return n, err }
|
n += nn; if err != nil { return n, err }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user