WriteInt64 write int64 with the tag.
(data int64, tag byte)
| 271 | |
| 272 | // WriteInt64 write int64 with the tag. |
| 273 | func (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. |
| 292 | func (b *Buffer) WriteFloat32(data float32, tag byte) error { |