chore: migrate to gitea
Some checks failed
golangci-lint / lint (push) Failing after 1m30s
Test / test (push) Failing after 2m17s

This commit is contained in:
2026-01-27 00:40:46 +01:00
parent 1e05874160
commit f8df24c29d
3169 changed files with 1216434 additions and 1587 deletions

31
vendor/github.com/bytedance/sonic/internal/rt/pool.go generated vendored Normal file
View File

@@ -0,0 +1,31 @@
package rt
import (
"unsafe"
)
type SlicePool struct {
pool unsafe.Pointer
len int
index int
typ uintptr
}
func NewPool(typ *GoType, size int) SlicePool {
return SlicePool{pool: newarray(typ, size), len: size, typ: uintptr(unsafe.Pointer(typ))}
}
func (self *SlicePool) GetSlice(size int) unsafe.Pointer {
// pool is full, fallback to normal alloc
if size > self.Remain() {
return newarray(AsGoType(self.typ), size)
}
ptr := PtrAdd(self.pool, uintptr(self.index)* AsGoType(self.typ).Size)
self.index += size
return ptr
}
func (self *SlicePool) Remain() int {
return self.len - self.index
}