MCPcopy Create free account
hub / github.com/cloudwego/dynamicgo / FastWriteNocopy

Method FastWriteNocopy

testdata/kitex_gen/example3/k-example3.go:2298–2332  ·  view source on GitHub ↗
(b []byte, w thrift.NocopyWriter)

Source from the content-addressed store, hash-verified

2296func (p *InnerCode) FastWrite(b []byte) int { return p.FastWriteNocopy(b, nil) }
2297
2298func (p *InnerCode) FastWriteNocopy(b []byte, w thrift.NocopyWriter) int {
2299 if p == nil {
2300 b[0] = 0
2301 return 1
2302 }
2303 off := 0
2304
2305 // p.C1 ID:1 thrift.I64
2306 b[off] = 10
2307 binary.BigEndian.PutUint16(b[off+1:], 1)
2308 off += 3
2309 binary.BigEndian.PutUint64(b[off:], uint64(p.C1))
2310 off += 8
2311
2312 // p.C2 ID:2 thrift.I16
2313 b[off] = 6
2314 binary.BigEndian.PutUint16(b[off+1:], 2)
2315 off += 3
2316 binary.BigEndian.PutUint16(b[off:], uint16(p.C2))
2317 off += 2
2318
2319 // p.C3 ID:3 thrift.LIST
2320 b[off] = 15
2321 binary.BigEndian.PutUint16(b[off+1:], 3)
2322 off += 3
2323 b[off] = 12
2324 binary.BigEndian.PutUint32(b[off+1:], uint32(len(p.C3)))
2325 off += 5
2326 for _, v := range p.C3 {
2327 off += v.FastWriteNocopy(b[off:], w)
2328 }
2329
2330 b[off] = 0
2331 return off + 1
2332}
2333
2334func (p *InnerCode) FastRead(b []byte) (off int, err error) {
2335 var ftyp thrift.TType

Callers 1

FastWriteMethod · 0.95

Calls 1

FastWriteNocopyMethod · 0.45

Tested by

no test coverage detected