mirror of
https://github.com/Monibuca/engine.git
synced 2025-10-06 00:56:58 +08:00
fix: SplitBuffers函数导致修改原数组的内容的bug
This commit is contained in:
@@ -97,6 +97,7 @@ func SizeOfBuffers[T ~[]byte](buf []T) (size int) {
|
||||
|
||||
// SplitBuffers 按照一定大小分割 Buffers
|
||||
func SplitBuffers[T ~[]byte](buf []T, size int) (result [][]T) {
|
||||
buf = append([]T(nil), buf...)
|
||||
for total := SizeOfBuffers(buf); total > 0; {
|
||||
if total <= size {
|
||||
return append(result, buf)
|
||||
|
Reference in New Issue
Block a user