MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / Remove

Method Remove

projects/Go/proto/fbe/Buffer.go:134–149  ·  view source on GitHub ↗

Remove some memory of the given size from the current write buffer

(offset int, size int)

Source from the content-addressed store, hash-verified

132
133// Remove some memory of the given size from the current write buffer
134func (b *Buffer) Remove(offset int, size int) {
135 if (offset + size) > len(b.data) {
136 panic("invalid offset & size")
137 }
138
139 copy(b.data[offset:], b.data[offset+size:])
140 b.size -= size
141 if b.offset >= (offset + size) {
142 b.offset -= size
143 } else if b.offset >= offset {
144 b.offset -= b.offset - offset
145 if b.offset > b.size {
146 b.offset = b.size
147 }
148 }
149}
150
151// Reserve memory of the given capacity in the current write bufferb
152func (b *Buffer) Reserve(capacity int) {

Callers 1

SendSerializedMethod · 0.45

Calls

no outgoing calls

Tested by

no test coverage detected