WriteInt writes the signed integer v of either 8, 16, 32 or 64 bits to w.
(w Writer, bits int32, v int64)
| 77 | |
| 78 | // WriteInt writes the signed integer v of either 8, 16, 32 or 64 bits to w. |
| 79 | func WriteInt(w Writer, bits int32, v int64) { |
| 80 | switch bits { |
| 81 | case 8: |
| 82 | w.Int8(int8(v)) |
| 83 | case 16: |
| 84 | w.Int16(int16(v)) |
| 85 | case 32: |
| 86 | w.Int32(int32(v)) |
| 87 | case 64: |
| 88 | w.Int64(int64(v)) |
| 89 | default: |
| 90 | w.SetError(fmt.Errorf("Unsupported integer bit count %v", bits)) |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | // WriteBytes writes the given v for count times to writer w. |
| 95 | func WriteBytes(w Writer, v uint8, count int32) { |