VariableInt writes an int64 using variable-length encoding. Smaller values use less space at the cost of larger values using more bytes, but this is generally more space-efficient. This does carry a small computational hit when reading.
(val int64)
| 132 | // values using more bytes, but this is generally more space-efficient. This does carry a small computational hit when |
| 133 | // reading. |
| 134 | func (writer *Writer) VariableInt(val int64) { |
| 135 | count := binary.PutVarint(writer.numSlice, val) |
| 136 | writer.buf.Write(writer.numSlice[:count]) |
| 137 | } |
| 138 | |
| 139 | // VariableUint writes a uint64 using variable-length encoding. Smaller values use less space at the cost of larger |
| 140 | // values using more bytes, but this is generally more space-efficient. This does carry a small computational hit when |