Improve WriteZeroN using clear in go1.21

This commit is contained in:
世界 2023-12-09 23:43:36 +08:00
parent 2a2dbf1971
commit ad670bab68
No known key found for this signature in database
GPG key ID: CD109927C34A63C4

View file

@ -216,10 +216,7 @@ func (b *Buffer) WriteZeroN(n int) error {
if b.end+n > b.capacity {
return io.ErrShortBuffer
}
for i := b.end; i < b.end+n; i++ {
b.data[i] = 0
}
b.end += n
common.ClearArray(b.Extend(n))
return nil
}