Shorten may be called to shorten the length of an allocated vector. This is useful when you know that a vector has a limit but you're not sure how large it might be. Create the vector with max length, write to it with Set, then shorten it to the actual length.
(length uint32)
| 67 | // sure how large it might be. Create the vector with max length, write |
| 68 | // to it with Set, then shorten it to the actual length. |
| 69 | func (b *Bits) Shorten(length uint32) { |
| 70 | b.length = length |
| 71 | } |
| 72 | |
| 73 | func (b Bits) Len() uint32 { |
| 74 | return b.length |