[][src]Function tantivy::i64_to_u64

pub fn i64_to_u64(val: i64) -> u64

Maps a i64 to u64

For simplicity, tantivy internally handles i64 as u64. The mapping is defined by this function.

Maps i64 to u64 so that -2^63 .. 2^63-1 is mapped to 0 .. 2^64-1 in that order.

This is more suited than simply casting (val as u64) because of bitpacking.

Imagine a list of i64 ranging from -10 to 10. When casting negative values, the negative values are projected to values over 2^63, and all values end up requiring 64 bits.

See also

The reverse mapping is u64_to_i64.