mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
Simplify some code in VectorisedView#ToView.
PiperOrigin-RevId: 212317717 Change-Id: Ic77449c53bf2f8be92c9f0a7a726c45bd35ec435
This commit is contained in:
committed by
Shentubot
parent
e198f9ab02
commit
da9ecb748c
@@ -154,13 +154,11 @@ func (vv *VectorisedView) Size() int {
|
||||
|
||||
// ToView returns a single view containing the content of the vectorised view.
|
||||
func (vv *VectorisedView) ToView() View {
|
||||
v := make([]byte, vv.size)
|
||||
u := v
|
||||
for i := range vv.views {
|
||||
n := copy(u, vv.views[i])
|
||||
u = u[n:]
|
||||
u := make([]byte, 0, vv.size)
|
||||
for _, v := range vv.views {
|
||||
u = append(u, v...)
|
||||
}
|
||||
return v
|
||||
return u
|
||||
}
|
||||
|
||||
// Views returns the slice containing the all views.
|
||||
|
||||
Reference in New Issue
Block a user