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

Method WriteInt32

tars/protocol/codec/codec.go:249–265  ·  view source on GitHub ↗

WriteInt32 write int32 with the tag.

(data int32, tag byte)

Source from the content-addressed store, hash-verified

247
248// WriteInt32 write int32 with the tag.
249func (b *Buffer) WriteInt32(data int32, tag byte) error {
250 var err error
251 if data >= math.MinInt16 && data <= math.MaxInt16 {
252 if err = b.WriteInt16(int16(data), tag); err != nil {
253 return err
254 }
255 } else {
256 if err = b.WriteHead(INT, tag); err != nil {
257 return err
258 }
259
260 if err = bWriteU32(b.buf, uint32(data)); err != nil {
261 return err
262 }
263 }
264 return nil
265}
266
267// WriteUint32 write uint32 data with the tag.
268func (b *Buffer) WriteUint32(data uint32, tag byte) error {

Callers 15

WriteUint16Method · 0.95
WriteInt64Method · 0.95
TestInt32Function · 0.95
TestInt32_2Function · 0.95
DispatchMethod · 0.95
LoggerWithContextMethod · 0.95

Calls 3

WriteInt16Method · 0.95
WriteHeadMethod · 0.95
bWriteU32Function · 0.85

Tested by 2

TestInt32Function · 0.76
TestInt32_2Function · 0.76