| 146 | Ok(()) |
| 147 | } |
| 148 | fn byte_sequence(&mut self, bytes: &[u8]) -> SResult<()> { |
| 149 | if self.sequential |
| 150 | && self.c.content_hash.is_some() |
| 151 | && self |
| 152 | .authored |
| 153 | .get(self.source_cursor..) |
| 154 | .is_some_and(|rest| rest.starts_with(bytes)) |
| 155 | { |
| 156 | let length = self.column(6, bytes.len() as u64)?; |
| 157 | self.c.control.push(21); |
| 158 | put(&mut self.c.control, length as u64); |
| 159 | self.source_cursor += bytes.len(); |
| 160 | return Ok(()); |
| 161 | } |
| 162 | if let Some(&offset) = self.content_lookup.get(bytes) { |
| 163 | let a = self.column(5, offset as u64)?; |
| 164 | let b = self.column(6, bytes.len() as u64)?; |
| 165 | self.c.control.push(20); |
| 166 | put(&mut self.c.control, a as u64); |
| 167 | put(&mut self.c.control, b as u64); |
| 168 | self.source_cursor = offset + bytes.len(); |
| 169 | Ok(()) |
| 170 | } else { |
| 171 | self.reference(bytes, 18) |
| 172 | } |
| 173 | } |
| 174 | fn small_number(&mut self, kind: u8, n: u64) -> SResult<()> { |
| 175 | if n < 16 { |
| 176 | self.c.control.push(n as u8); |