pub fn write_varint<W: Write>(writer: &mut W, value: u64) -> Result<()>
Encode a u64 using unsigned varint encoding (used for smaller storage).