|
1 | 1 | #![allow(dead_code)] |
2 | 2 |
|
3 | | -#[inline(always)] |
4 | | -pub(crate) unsafe fn memcmp0(_: &[u8], _: &[u8]) -> bool { |
| 3 | +#[inline] |
| 4 | +pub unsafe fn memcmp0(_: &[u8], _: &[u8]) -> bool { |
5 | 5 | true |
6 | 6 | } |
7 | 7 |
|
8 | | -#[inline(always)] |
9 | | -pub(crate) unsafe fn memcmp1(left: &[u8], right: &[u8]) -> bool { |
| 8 | +#[inline] |
| 9 | +pub unsafe fn memcmp1(left: &[u8], right: &[u8]) -> bool { |
10 | 10 | *left == *right |
11 | 11 | } |
12 | 12 |
|
13 | | -#[inline(always)] |
14 | | -pub(crate) unsafe fn memcmp2(left: &[u8], right: &[u8]) -> bool { |
| 13 | +#[inline] |
| 14 | +pub unsafe fn memcmp2(left: &[u8], right: &[u8]) -> bool { |
15 | 15 | let left = left.as_ptr().cast::<u16>(); |
16 | 16 | let right = right.as_ptr().cast::<u16>(); |
17 | 17 | *left == *right |
18 | 18 | } |
19 | 19 |
|
20 | | -#[inline(always)] |
21 | | -pub(crate) unsafe fn memcmp3(left: &[u8], right: &[u8]) -> bool { |
| 20 | +#[inline] |
| 21 | +pub unsafe fn memcmp3(left: &[u8], right: &[u8]) -> bool { |
22 | 22 | let left = left.as_ptr().cast::<u32>(); |
23 | 23 | let right = right.as_ptr().cast::<u32>(); |
24 | 24 | (*left & 0x00ffffff) == (*right & 0x00ffffff) |
25 | 25 | } |
26 | 26 |
|
27 | | -#[inline(always)] |
28 | | -pub(crate) unsafe fn memcmp4(left: &[u8], right: &[u8]) -> bool { |
| 27 | +#[inline] |
| 28 | +pub unsafe fn memcmp4(left: &[u8], right: &[u8]) -> bool { |
29 | 29 | let left = left.as_ptr().cast::<u32>(); |
30 | 30 | let right = right.as_ptr().cast::<u32>(); |
31 | 31 | *left == *right |
32 | 32 | } |
33 | 33 |
|
34 | | -#[inline(always)] |
35 | | -pub(crate) unsafe fn memcmp5(left: &[u8], right: &[u8]) -> bool { |
| 34 | +#[inline] |
| 35 | +pub unsafe fn memcmp5(left: &[u8], right: &[u8]) -> bool { |
36 | 36 | let left = left.as_ptr().cast::<u64>(); |
37 | 37 | let right = right.as_ptr().cast::<u64>(); |
38 | 38 | (*left ^ *right).trailing_zeros() >= 40 |
39 | 39 | } |
40 | 40 |
|
41 | | -#[inline(always)] |
42 | | -pub(crate) unsafe fn memcmp6(left: &[u8], right: &[u8]) -> bool { |
| 41 | +#[inline] |
| 42 | +pub unsafe fn memcmp6(left: &[u8], right: &[u8]) -> bool { |
43 | 43 | let left = left.as_ptr().cast::<u64>(); |
44 | 44 | let right = right.as_ptr().cast::<u64>(); |
45 | 45 | (*left ^ *right).trailing_zeros() >= 48 |
46 | 46 | } |
47 | 47 |
|
48 | 48 | #[allow(dead_code)] |
49 | | -#[inline(always)] |
50 | | -pub(crate) unsafe fn memcmp7(left: &[u8], right: &[u8]) -> bool { |
| 49 | +#[inline] |
| 50 | +pub unsafe fn memcmp7(left: &[u8], right: &[u8]) -> bool { |
51 | 51 | let left = left.as_ptr().cast::<u64>(); |
52 | 52 | let right = right.as_ptr().cast::<u64>(); |
53 | 53 | (*left ^ *right).trailing_zeros() >= 56 |
54 | 54 | } |
55 | 55 |
|
56 | | -#[inline(always)] |
57 | | -pub(crate) unsafe fn memcmp8(left: &[u8], right: &[u8]) -> bool { |
| 56 | +#[inline] |
| 57 | +pub unsafe fn memcmp8(left: &[u8], right: &[u8]) -> bool { |
58 | 58 | let left = left.as_ptr().cast::<u64>(); |
59 | 59 | let right = right.as_ptr().cast::<u64>(); |
60 | 60 | *left == *right |
61 | 61 | } |
62 | 62 |
|
63 | | -#[inline(always)] |
64 | | -pub(crate) unsafe fn memcmp9(left: &[u8], right: &[u8]) -> bool { |
| 63 | +#[inline] |
| 64 | +pub unsafe fn memcmp9(left: &[u8], right: &[u8]) -> bool { |
65 | 65 | let left_first = left.as_ptr().cast::<u64>(); |
66 | 66 | let right_first = right.as_ptr().cast::<u64>(); |
67 | 67 | *left_first == *right_first && *left.as_ptr().add(8) == *right.as_ptr().add(8) |
68 | 68 | } |
69 | 69 |
|
70 | | -#[inline(always)] |
71 | | -pub(crate) unsafe fn memcmp10(left: &[u8], right: &[u8]) -> bool { |
| 70 | +#[inline] |
| 71 | +pub unsafe fn memcmp10(left: &[u8], right: &[u8]) -> bool { |
72 | 72 | let left_first = left.as_ptr().cast::<u64>(); |
73 | 73 | let right_first = right.as_ptr().cast::<u64>(); |
74 | 74 | let left_second = left.as_ptr().add(8).cast::<u16>(); |
75 | 75 | let right_second = right.as_ptr().add(8).cast::<u16>(); |
76 | 76 | *left_first == *right_first && *left_second == *right_second |
77 | 77 | } |
78 | 78 |
|
79 | | -#[inline(always)] |
80 | | -pub(crate) unsafe fn memcmp11(left: &[u8], right: &[u8]) -> bool { |
| 79 | +#[inline] |
| 80 | +pub unsafe fn memcmp11(left: &[u8], right: &[u8]) -> bool { |
81 | 81 | let left_first = left.as_ptr().cast::<u64>(); |
82 | 82 | let right_first = right.as_ptr().cast::<u64>(); |
83 | 83 | let left_second = left.as_ptr().add(8).cast::<u32>(); |
84 | 84 | let right_second = right.as_ptr().add(8).cast::<u32>(); |
85 | 85 | *left_first == *right_first && (*left_second & 0x00ffffff) == (*right_second & 0x00ffffff) |
86 | 86 | } |
87 | 87 |
|
88 | | -#[inline(always)] |
89 | | -pub(crate) unsafe fn memcmp12(left: &[u8], right: &[u8]) -> bool { |
| 88 | +#[inline] |
| 89 | +pub unsafe fn memcmp12(left: &[u8], right: &[u8]) -> bool { |
90 | 90 | let left_first = left.as_ptr().cast::<u64>(); |
91 | 91 | let right_first = right.as_ptr().cast::<u64>(); |
92 | 92 | let left_second = left.as_ptr().add(8).cast::<u32>(); |
93 | 93 | let right_second = right.as_ptr().add(8).cast::<u32>(); |
94 | 94 | *left_first == *right_first && *left_second == *right_second |
95 | 95 | } |
96 | 96 |
|
97 | | -#[inline(always)] |
98 | | -pub(crate) unsafe fn memcmp(left: &[u8], right: &[u8]) -> bool { |
| 97 | +#[inline] |
| 98 | +pub unsafe fn memcmp(left: &[u8], right: &[u8]) -> bool { |
99 | 99 | left == right |
100 | 100 | } |
0 commit comments