Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions tsc/internal/core/arena.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ type Arena[T any] struct {
// capacity and unrelated values retained by a surviving pointer into a chunk.
func (a *Arena[T]) New() *T {
if len(a.data) == cap(a.data) {
nextSize := nextArenaSize[T](len(a.data))
nextSize := nextArenaSize[T](cap(a.data))
// Use the same trick as slices.Concat; Grow rounds up to the next size class.
a.data = slices.Grow[[]T](nil, nextSize)
}
Expand All @@ -33,7 +33,7 @@ func (a *Arena[T]) NewSlice(size int) []T {
return nil
}
if len(a.data)+size > cap(a.data) {
nextSize := nextArenaSize[T](len(a.data))
nextSize := nextArenaSize[T](cap(a.data))
Comment thread
jakebailey marked this conversation as resolved.
Resolved
if size > nextSize {
return make([]T, size)
}
Expand Down
Loading