WriteInt32 write int32 with the tag.
(data int32, tag byte)
| 247 | |
| 248 | // WriteInt32 write int32 with the tag. |
| 249 | func (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. |
| 268 | func (b *Buffer) WriteUint32(data uint32, tag byte) error { |