(&mut self, out: &mut Vec<u8>, n: u64)
| 115 | pub(super) struct Delta(pub u64); |
| 116 | impl Delta { |
| 117 | pub fn write(&mut self, out: &mut Vec<u8>, n: u64) { |
| 118 | let d = n.wrapping_sub(self.0); |
| 119 | put(out, (d << 1) ^ ((d as i64 >> 63) as u64)); |
| 120 | self.0 = n; |
| 121 | } |
| 122 | pub fn read(&mut self, input: &mut &[u8]) -> FormatResult<u64> { |
| 123 | let z = get(input)?; |
| 124 | self.0 = self.0.wrapping_add((z >> 1) ^ 0u64.wrapping_sub(z & 1)); |