MCPcopy Create free account
hub / github.com/apache/paimon-rust / encode_varint

Function encode_varint

crates/paimon/src/arrow/format/blob.rs:760–767  ·  view source on GitHub ↗
(value: i64, out: &mut Vec<u8>)

Source from the content-addressed store, hash-verified

758}
759
760fn 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)]
770mod tests {

Callers 2

Calls

no outgoing calls

Tested by 1