MCPcopy Create free account
hub / github.com/apache/fory / growSlow

Method growSlow

go/fory/buffer.go:172–182  ·  view source on GitHub ↗

growSlow handles the cold path when buffer expansion is needed. go:noinline

(n int)

Source from the content-addressed store, hash-verified

170//
171//go:noinline
172func (b *ByteBuffer) growSlow(n int) {
173 needed := b.writerIndex + n
174 if needed <= cap(b.data) {
175 b.data = b.data[:cap(b.data)]
176 } else {
177 newCap := 2 * needed
178 newBuf := make([]byte, newCap)
179 copy(newBuf, b.data[:b.writerIndex])
180 b.data = newBuf
181 }
182}
183
184func (b *ByteBuffer) WriteBool(value bool) {
185 b.grow(1)

Callers 1

growMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected