arena: fix MakeSlice
This commit is contained in:
parent
bc8a1a4001
commit
4f8383d497
1 changed files with 1 additions and 1 deletions
|
|
@ -24,7 +24,7 @@ func New[T any](arena Arena) *T {
|
||||||
//
|
//
|
||||||
// Note: Accessing the returned slice after calling Reset is unsafe and may result in a fault.
|
// Note: Accessing the returned slice after calling Reset is unsafe and may result in a fault.
|
||||||
func MakeSlice[T any](arena Arena, len, cap int) []T {
|
func MakeSlice[T any](arena Arena, len, cap int) []T {
|
||||||
ptr, err := arena(ACTION_ALLOC, mem.Sizeof[T]()*uintptr(len), mem.Alignof[T](), nil)
|
ptr, err := arena(ACTION_ALLOC, mem.Sizeof[T]()*uintptr(cap), mem.Alignof[T](), nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue