Commit 0413e93b authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6745433a
...@@ -686,7 +686,7 @@ func (e *encoder) genArray1(path string, typ *types.Array) { ...@@ -686,7 +686,7 @@ func (e *encoder) genArray1(path string, typ *types.Array) {
func (d *decoder) genArray1(assignto string, typ *types.Array) { func (d *decoder) genArray1(assignto string, typ *types.Array) {
typLen := int(typ.Len()) typLen := int(typ.Len())
d.emit("copy(%v[:], data[%v:%v])", assignto, d.n, d.n + typLen) d.emit("copy(%v[:], data[%v:%v])", assignto, d.n, d.n+typLen)
d.n += typLen d.n += typLen
d.overflow.Add(typLen) d.overflow.Add(typLen)
} }
...@@ -823,7 +823,7 @@ func (s *sizer) genMap(path string, typ *types.Map, obj types.Object) { ...@@ -823,7 +823,7 @@ func (s *sizer) genMap(path string, typ *types.Map, obj types.Object) {
if keyFixed && elemFixed { if keyFixed && elemFixed {
s.size.Add(4) s.size.Add(4)
s.size.AddExpr("len(%v) * %v", path, keySize + elemSize) s.size.AddExpr("len(%v) * %v", path, keySize+elemSize)
return return
} }
...@@ -880,7 +880,7 @@ func (d *decoder) genMap(assignto string, typ *types.Map, obj types.Object) { ...@@ -880,7 +880,7 @@ func (d *decoder) genMap(assignto string, typ *types.Map, obj types.Object) {
elemSize, elemFixed := typeSizeFixed(typ.Elem()) elemSize, elemFixed := typeSizeFixed(typ.Elem())
if keyFixed && elemFixed { if keyFixed && elemFixed {
d.overflowCheck() d.overflowCheck()
d.overflow.AddExpr("l * %v", keySize + elemSize) d.overflow.AddExpr("l * %v", keySize+elemSize)
d.overflow.PushChecked(true) d.overflow.PushChecked(true)
defer d.overflow.PopChecked() defer d.overflow.PopChecked()
} }
...@@ -933,7 +933,7 @@ func codegenType(path string, typ types.Type, obj types.Object, codegen CodeGene ...@@ -933,7 +933,7 @@ func codegenType(path string, typ types.Type, obj types.Object, codegen CodeGene
case *types.Struct: case *types.Struct:
for i := 0; i < u.NumFields(); i++ { for i := 0; i < u.NumFields(); i++ {
v := u.Field(i) v := u.Field(i)
codegenType(path + "." + v.Name(), v.Type(), v, codegen) codegenType(path+"."+v.Name(), v.Type(), v, codegen)
} }
case *types.Array: case *types.Array:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment