remove unnecessary assignments

This commit is contained in:
IncSW 2021-05-03 10:55:17 +03:00
parent e6ff77fe8d
commit c7747ba9b2
No known key found for this signature in database
GPG Key ID: 89876FA64BFB2D57
1 changed files with 4 additions and 14 deletions

View File

@ -131,18 +131,13 @@ func (d *sliceDecoder) decodeStream(s *stream, depth int64, p unsafe.Pointer) er
slice.cap = capacity
slice.len = idx + 1
slice.data = data
dst := *(*sliceHeader)(p)
dst := (*sliceHeader)(p)
dst.len = idx + 1
if dst.len > dst.cap {
dst.data = newArray(d.elemType, dst.len)
dst.cap = dst.len
}
copySlice(d.elemType, dst, sliceHeader{
data: slice.data,
len: slice.len,
cap: slice.cap,
})
*(*sliceHeader)(p) = dst
copySlice(d.elemType, *dst, *slice)
d.releaseSlice(slice)
s.cursor++
return nil
@ -247,18 +242,13 @@ func (d *sliceDecoder) decode(buf []byte, cursor, depth int64, p unsafe.Pointer)
slice.cap = capacity
slice.len = idx + 1
slice.data = data
dst := *(*sliceHeader)(p)
dst := (*sliceHeader)(p)
dst.len = idx + 1
if dst.len > dst.cap {
dst.data = newArray(d.elemType, dst.len)
dst.cap = dst.len
}
copySlice(d.elemType, dst, sliceHeader{
data: slice.data,
len: slice.len,
cap: slice.cap,
})
**(**sliceHeader)(unsafe.Pointer(&p)) = dst
copySlice(d.elemType, *dst, *slice)
d.releaseSlice(slice)
cursor++
return cursor, nil