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

Method WriteInt8

tars/protocol/codec/codec.go:192–208  ·  view source on GitHub ↗

WriteInt8 write int8 with the tag.

(data int8, tag byte)

Source from the content-addressed store, hash-verified

190
191// WriteInt8 write int8 with the tag.
192func (b *Buffer) WriteInt8(data int8, tag byte) error {
193 var err error
194 if data == 0 {
195 if err = b.WriteHead(ZeroTag, tag); err != nil {
196 return err
197 }
198 } else {
199 if err = b.WriteHead(BYTE, tag); err != nil {
200 return err
201 }
202
203 if err = b.buf.WriteByte(byte(data)); err != nil {
204 return err
205 }
206 }
207 return nil
208}
209
210// WriteUint8 write uint8 with the tag
211func (b *Buffer) WriteUint8(data uint8, tag byte) error {

Callers 6

WriteBoolMethod · 0.95
WriteInt16Method · 0.95
TestInt8Function · 0.95
WriteToMethod · 0.80
WriteToMethod · 0.80
putBaseMethod · 0.80

Calls 1

WriteHeadMethod · 0.95

Tested by 1

TestInt8Function · 0.76