(value: i64, out: &mut Vec<u8>)
| 758 | } |
| 759 | |
| 760 | fn encode_varint(value: i64, out: &mut Vec<u8>) { |
| 761 | let mut remaining = ((value << 1) ^ (value >> 63)) as u64; |
| 762 | while (remaining & !0x7f) != 0 { |
| 763 | out.push(((remaining & 0x7f) as u8) | 0x80); |
| 764 | remaining >>= 7; |
| 765 | } |
| 766 | out.push(remaining as u8); |
| 767 | } |
| 768 | |
| 769 | #[cfg(test)] |
| 770 | mod tests { |
no outgoing calls