Skip to content

Commit

Permalink
Improve WriteZeroN using clear in go1.21
Browse files Browse the repository at this point in the history
  • Loading branch information
nekohasekai committed Dec 9, 2023
1 parent 766839c commit e23ecbb
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions common/buf/buffer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit e23ecbb

Please sign in to comment.