| 1 | #[cfg(not(feature = "runtime-dispatch-simd"))] |
| 2 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::{memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/, ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/, usizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/usize/}; |
| 3 | #[cfg(feature = "runtime-dispatch-simd")] |
| 4 | use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::{memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/, ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/, usizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/usize/}; |
| 5 | |
| 6 | fn splatrust-analyzer cargo bytecount 0.6.9 integer_simd/splat().(byte: u8) -> usize { |
| 7 | let lo = usizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/usize/::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/usize/MAX. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().0xFF; |
| 8 | lo rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().byte as usize |
| 9 | } |
| 10 | |
| 11 | unsafe fn usize_load_uncheckedrust-analyzer cargo bytecount 0.6.9 integer_simd/usize_load_unchecked().(bytes: &[u8], offset: usize) -> usize { |
| 12 | let mut output = 0; |
| 13 | ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/::copy_nonoverlappingrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/copy_nonoverlapping().( |
| 14 | bytes.as_ptrrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]as_ptr().().addrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]add().(offset), |
| 15 | &mut output as *mut usize as *mut u8, |
| 16 | memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<usize>(), |
| 17 | ); |
| 18 | output |
| 19 | } |
| 20 | |
| 21 | fn bytewise_equalrust-analyzer cargo bytecount 0.6.9 integer_simd/bytewise_equal().(lhs: usize, rhs: usize) -> usize { |
| 22 | let lo = usizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/usize/::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/usize/MAX. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().0xFF; |
| 23 | let hi = lo rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shl<i32>`]shl().<<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shl<i32>`]shl(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shl<i32>`]shl().7; |
| 24 | |
| 25 | let x = lhs rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitXor<Self>`]bitxor().^rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitXor<Self>`]bitxor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitXor<Self>`]bitxor().rhs; |
| 26 | !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][Not]not().((((x rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][Not]not().hi) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][Not]not().hi) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitOr<Self>`]bitor().x) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr().7) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().lo |
| 27 | } |
| 28 | |
| 29 | fn sum_usizerust-analyzer cargo bytecount 0.6.9 integer_simd/sum_usize().(values: usize) -> usize { |
| 30 | let every_other_byte_lo = usizerust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/usize/::MAXrust-analyzer cargo core https://github.com/rust-lang/rust/library/core legacy_int_modules/usize/MAX. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().0xFFFF; |
| 31 | let every_other_byte = every_other_byte_lo rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().0xFF; |
| 32 | |
| 33 | // Pairwise reduction to avoid overflow on next step. |
| 34 | let pair_sum: usize = (values rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().every_other_byte) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().((values rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr().8) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().every_other_byte); |
| 35 | |
| 36 | // Multiplication results in top two bytes holding sum. |
| 37 | pair_sum.wrapping_mulrust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]wrapping_mul().(every_other_byte_lo) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<Self>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<Self>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<Self>`]shr().((memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<usize>() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().2) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().8) |
| 38 | } |
| 39 | |
| 40 | fn is_leading_utf8_byterust-analyzer cargo bytecount 0.6.9 integer_simd/is_leading_utf8_byte().(values: usize) -> usize { |
| 41 | // a leading UTF-8 byte is one which does not start with the bits 10. |
| 42 | ((!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][Not]not().values rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr().7) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitOr<Self>`]bitor().|rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitOr<Self>`]bitor(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitOr<Self>`]bitor().(values rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<i32>`]shr().6)) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().splatrust-analyzer cargo bytecount 0.6.9 integer_simd/splat().(1) |
| 43 | } |
| 44 | |
| 45 | pub fn chunk_countrust-analyzer cargo bytecount 0.6.9 integer_simd/chunk_count().(haystack: &[u8], needle: u8) -> usize { |
| 46 | let chunksize = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<usize>(); |
| 47 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(haystack.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() >= chunksize); |
| 48 | |
| 49 | unsafe { |
| 50 | let mut offset = 0; |
| 51 | let mut count = 0; |
| 52 | |
| 53 | let needles = splatrust-analyzer cargo bytecount 0.6.9 integer_simd/splat().(needle); |
| 54 | |
| 55 | // 2040 |
| 56 | while haystack.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().chunksize rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().255 { |
| 57 | let mut counts = 0; |
| 58 | for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#255 { |
| 59 | counts rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().bytewise_equalrust-analyzer cargo bytecount 0.6.9 integer_simd/bytewise_equal().(usize_load_uncheckedrust-analyzer cargo bytecount 0.6.9 integer_simd/usize_load_unchecked().(haystack, offset), needles); |
| 60 | offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().chunksize; |
| 61 | } |
| 62 | count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().sum_usizerust-analyzer cargo bytecount 0.6.9 integer_simd/sum_usize().(counts); |
| 63 | } |
| 64 | |
| 65 | // 8 |
| 66 | let mut counts = 0; |
| 67 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#(haystack.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().offset) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().chunksize { |
| 68 | counts rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().bytewise_equalrust-analyzer cargo bytecount 0.6.9 integer_simd/bytewise_equal().( |
| 69 | usize_load_uncheckedrust-analyzer cargo bytecount 0.6.9 integer_simd/usize_load_unchecked().(haystack, offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().chunksize), |
| 70 | needles, |
| 71 | ); |
| 72 | } |
| 73 | if haystack.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 { |
| 74 | let mask = usize::from_lerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]from_le().(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][Not]not().(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][Not]not().0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<Self>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<Self>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<Self>`]shr().((haystack.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().chunksize) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().8))); |
| 75 | counts rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().bytewise_equalrust-analyzer cargo bytecount 0.6.9 integer_simd/bytewise_equal().( |
| 76 | usize_load_uncheckedrust-analyzer cargo bytecount 0.6.9 integer_simd/usize_load_unchecked().(haystack, haystack.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().chunksize), |
| 77 | needles, |
| 78 | ) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().mask; |
| 79 | } |
| 80 | count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().sum_usizerust-analyzer cargo bytecount 0.6.9 integer_simd/sum_usize().(counts); |
| 81 | |
| 82 | count |
| 83 | } |
| 84 | } |
| 85 | |
| 86 | pub fn chunk_num_charsrust-analyzer cargo bytecount 0.6.9 integer_simd/chunk_num_chars().(utf8_chars: &[u8]) -> usize { |
| 87 | let chunksize = memrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/::size_ofrust-analyzer cargo core https://github.com/rust-lang/rust/library/core mem/size_of().::<usize>(); |
| 88 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(utf8_chars.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() >= chunksize); |
| 89 | |
| 90 | unsafe { |
| 91 | let mut offset = 0; |
| 92 | let mut count = 0; |
| 93 | |
| 94 | // 2040 |
| 95 | while utf8_chars.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().>=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]ge().offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().chunksize rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().255 { |
| 96 | let mut counts = 0; |
| 97 | for _ in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#255 { |
| 98 | counts rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().is_leading_utf8_byterust-analyzer cargo bytecount 0.6.9 integer_simd/is_leading_utf8_byte().(usize_load_uncheckedrust-analyzer cargo bytecount 0.6.9 integer_simd/usize_load_unchecked().(utf8_chars, offset)); |
| 99 | offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().chunksize; |
| 100 | } |
| 101 | count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().sum_usizerust-analyzer cargo bytecount 0.6.9 integer_simd/sum_usize().(counts); |
| 102 | } |
| 103 | |
| 104 | // 8 |
| 105 | let mut counts = 0; |
| 106 | for i in 0..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/Range#(utf8_chars.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().offset) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div()./rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Div<Self>`]div().chunksize { |
| 107 | counts rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). |
| 108 | is_leading_utf8_byterust-analyzer cargo bytecount 0.6.9 integer_simd/is_leading_utf8_byte().(usize_load_uncheckedrust-analyzer cargo bytecount 0.6.9 integer_simd/usize_load_unchecked().(utf8_chars, offset rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().+rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Add<Self>`]add().i rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().chunksize)); |
| 109 | } |
| 110 | if utf8_chars.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().8 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialEq<Self>`]ne().0 { |
| 111 | let mask = usize::from_lerust-analyzer cargo core https://github.com/rust-lang/rust/library/core num/impl#[usize]from_le().(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][Not]not().(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][Not]not().0 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<Self>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<Self>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`Shr<Self>`]shr().((utf8_chars.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().%rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Rem<Self>`]rem().chunksize) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Mul<Self>`]mul().8))); |
| 112 | counts rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().is_leading_utf8_byterust-analyzer cargo bytecount 0.6.9 integer_simd/is_leading_utf8_byte().(usize_load_uncheckedrust-analyzer cargo bytecount 0.6.9 integer_simd/usize_load_unchecked().( |
| 113 | utf8_chars, |
| 114 | utf8_chars.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`Sub<Self>`]sub().chunksize, |
| 115 | )) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[usize][`BitAnd<Self>`]bitand().mask; |
| 116 | } |
| 117 | count rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().sum_usizerust-analyzer cargo bytecount 0.6.9 integer_simd/sum_usize().(counts); |
| 118 | |
| 119 | count |
| 120 | } |
| 121 | } |