(&mut self)
| 196 | impl<'a> Decoder<'a, usize> for LengthDecoder<'a> { |
| 197 | #[inline(always)] |
| 198 | fn decode(&mut self) -> usize { |
| 199 | let length = unsafe { |
| 200 | let v = self.small.mut_slice().next_unchecked(); |
| 201 | |
| 202 | if v < 255 { |
| 203 | v as usize |
| 204 | } else { |
| 205 | #[cold] |
| 206 | unsafe fn cold(large: &mut IntDecoder<'_, usize>) -> usize { |
| 207 | large.decode() |
| 208 | } |
| 209 | cold(&mut self.large) |
| 210 | } |
| 211 | }; |
| 212 | |
| 213 | // Allows some checks in Vec::with_capacity to be removed if lto = true. |
| 214 | // Safety: sum < HUGE_LEN is checked in populate so all elements have to be < HUGE_LEN. |
| 215 | if length as u64 >= HUGE_LEN { |
| 216 | unsafe { std::hint::unreachable_unchecked() } |
| 217 | } |
| 218 | length |
| 219 | } |
| 220 | } |
| 221 | |
| 222 | #[cfg(test)] |
no test coverage detected