From ac06586fc4dc340ea7db82a1ac2c172affb56e90 Mon Sep 17 00:00:00 2001 From: qydysky Date: Sat, 16 Dec 2023 05:49:47 +0800 Subject: [PATCH] 1 --- slice/Blocks.go | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/slice/Blocks.go b/slice/Blocks.go index 39c907b..34acc57 100644 --- a/slice/Blocks.go +++ b/slice/Blocks.go @@ -44,9 +44,8 @@ func NewBlocks[T any](blockSize int, blockNum int) BlocksI[T] { func (t *blocks[T]) Get() ([]T, func(), error) { select { case offset := <-t.free: - offset *= t.size - return t.buf[offset : offset+t.size], func() { - clear(t.buf[offset : offset+t.size]) + return t.buf[offset*t.size : (offset+1)*t.size], func() { + clear(t.buf[offset*t.size : (offset+1)*t.size]) t.free <- offset }, nil default: -- 2.39.2