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

Method WriteInt64

tars/protocol/codec/codec.go:273–289  ·  view source on GitHub ↗

WriteInt64 write int64 with the tag.

(data int64, tag byte)

Source from the content-addressed store, hash-verified

271
272// WriteInt64 write int64 with the tag.
273func (b *Buffer) WriteInt64(data int64, tag byte) error {
274 var err error
275 if data >= math.MinInt32 && data <= math.MaxInt32 {
276 if err = b.WriteInt32(int32(data), tag); err != nil {
277 return err
278 }
279 } else {
280 if err = b.WriteHead(LONG, tag); err != nil {
281 return err
282 }
283
284 if err = bWriteU64(b.buf, uint64(data)); err != nil {
285 return err
286 }
287 }
288 return nil
289}
290
291// WriteFloat32 writes float32 with the tag.
292func (b *Buffer) WriteFloat32(data float32, tag byte) error {

Callers 6

WriteUint32Method · 0.95
TestInt64Function · 0.95
TestSkipStruct2Function · 0.95
WriteToMethod · 0.80
WriteToMethod · 0.80
putBaseMethod · 0.80

Calls 3

WriteInt32Method · 0.95
WriteHeadMethod · 0.95
bWriteU64Function · 0.85

Tested by 2

TestInt64Function · 0.76
TestSkipStruct2Function · 0.76