Wrapping differences cover the entire u64 domain, including descending IDs.
(out: &mut Vec<u8>, previous: &mut u64, next: u64)
| 51 | |
| 52 | // Wrapping differences cover the entire u64 domain, including descending IDs. |
| 53 | fn delta(out: &mut Vec<u8>, previous: &mut u64, next: u64) { |
| 54 | let d = next.wrapping_sub(*previous); |
| 55 | put(out, (d << 1) ^ ((d as i64 >> 63) as u64)); |
| 56 | *previous = next; |
| 57 | } |
| 58 | |
| 59 | fn undelta(input: &mut &[u8], previous: &mut u64) -> Result<u64> { |
| 60 | let z = get(input)?; |