(bytes: &[u8])
| 48 | |
| 49 | impl TimestampParser { |
| 50 | fn new(bytes: &[u8]) -> Self { |
| 51 | let mut digits = [0; 32]; |
| 52 | let mut mask = 0; |
| 53 | |
| 54 | // Treating all bytes the same way, helps LLVM vectorise this correctly |
| 55 | for (idx, (o, i)) in digits.iter_mut().zip(bytes).enumerate() { |
| 56 | *o = i.wrapping_sub(b'0'); |
| 57 | mask |= ((*o < 10) as u32) << idx |
| 58 | } |
| 59 | |
| 60 | Self { digits, mask } |
| 61 | } |
| 62 | |
| 63 | /// Returns true if the byte at `idx` in the original string equals `b` |
| 64 | fn test(&self, idx: usize, b: u8) -> bool { |
nothing calls this directly
no test coverage detected