MCPcopy
hub / github.com/TarsCloud/TarsGo / WriteHead

Method WriteHead

tars/protocol/codec/codec.go:155–166  ·  view source on GitHub ↗

go:nosplit

(ty byte, tag byte)

Source from the content-addressed store, hash-verified

153
154//go:nosplit
155func (b *Buffer) WriteHead(ty byte, tag byte) error {
156 if tag < 15 {
157 data := (tag << 4) | ty
158 return b.buf.WriteByte(data)
159 } else {
160 data := (15 << 4) | ty
161 if err := b.buf.WriteByte(data); err != nil {
162 return err
163 }
164 return b.buf.WriteByte(tag)
165 }
166}
167
168// Reset clean the buffer.
169func (b *Buffer) Reset() {

Callers 15

WriteInt8Method · 0.95
WriteInt16Method · 0.95
WriteInt32Method · 0.95
WriteInt64Method · 0.95
WriteFloat32Method · 0.95
WriteFloat64Method · 0.95
WriteStringMethod · 0.95
TestSkipStructFunction · 0.95
TestSkipStruct2Function · 0.95
DispatchMethod · 0.95
LoggerWithContextMethod · 0.95

Calls

no outgoing calls

Tested by 2

TestSkipStructFunction · 0.76
TestSkipStruct2Function · 0.76