MCPcopy Create free account
hub / github.com/go-git/go-git / encodeCopyOperation

Function encodeCopyOperation

plumbing/format/packfile/diff_delta.go:182–204  ·  view source on GitHub ↗
(offset, length int)

Source from the content-addressed store, hash-verified

180}
181
182func encodeCopyOperation(offset, length int) []byte {
183 code := 0x80
184 var opcodes []byte
185
186 var i uint
187 for i = 0; i < 4; i++ {
188 f := 0xff << (i * 8)
189 if offset&f != 0 {
190 opcodes = append(opcodes, byte(offset&f>>(i*8)))
191 code |= 0x01 << i
192 }
193 }
194
195 for i = 0; i < 3; i++ {
196 f := 0xff << (i * 8)
197 if length&f != 0 {
198 opcodes = append(opcodes, byte(length&f>>(i*8)))
199 code |= 0x10 << i
200 }
201 }
202
203 return append([]byte{byte(code)}, opcodes...)
204}

Callers 1

diffDeltaFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected