1
- use crate :: * ;
2
- use std:: arch:: aarch64:: * ;
1
+ use crate :: { static_cast_i32, Stage1Parse } ;
2
+ use std:: arch:: aarch64:: {
3
+ int32x4_t, int8x16_t, uint8x16_t, vaddq_s32, vandq_u8, vceqq_u8, vcleq_u8, vdupq_n_s8,
4
+ vgetq_lane_u64, vld1q_u8, vmovq_n_u8, vmull_p64, vpaddq_u8, vqtbl1q_u8, vreinterpretq_u64_u8,
5
+ vreinterpretq_u8_s8, vshrq_n_u8, vtstq_u8,
6
+ } ;
3
7
use std:: mem;
4
8
5
9
// NEON-SPECIFIC
@@ -51,10 +55,10 @@ impl SimdInput {
51
55
pub ( crate ) fn new ( ptr : & [ u8 ] ) -> Self {
52
56
unsafe {
53
57
Self {
54
- v0 : vld1q_u8 ( ptr. as_ptr ( ) as * const u8 ) ,
55
- v1 : vld1q_u8 ( ptr. as_ptr ( ) . add ( 16 ) as * const u8 ) ,
56
- v2 : vld1q_u8 ( ptr. as_ptr ( ) . add ( 32 ) as * const u8 ) ,
57
- v3 : vld1q_u8 ( ptr. as_ptr ( ) . add ( 48 ) as * const u8 ) ,
58
+ v0 : vld1q_u8 ( ptr. as_ptr ( ) . cast :: < u8 > ( ) ) ,
59
+ v1 : vld1q_u8 ( ptr. as_ptr ( ) . add ( 16 ) . cast :: < u8 > ( ) ) ,
60
+ v2 : vld1q_u8 ( ptr. as_ptr ( ) . add ( 32 ) . cast :: < u8 > ( ) ) ,
61
+ v3 : vld1q_u8 ( ptr. as_ptr ( ) . add ( 48 ) . cast :: < u8 > ( ) ) ,
58
62
}
59
63
}
60
64
}
@@ -66,8 +70,8 @@ impl Stage1Parse<int8x16_t> for SimdInput {
66
70
unsafe {
67
71
vgetq_lane_u64 (
68
72
vreinterpretq_u64_u8 ( mem:: transmute ( vmull_p64 (
69
- mem:: transmute ( -1 as i64 ) ,
70
- mem:: transmute ( quote_bits as i64 ) ,
73
+ mem:: transmute ( -1_i64 ) ,
74
+ mem:: transmute ( quote_bits) ,
71
75
) ) ) ,
72
76
0 ,
73
77
)
@@ -178,7 +182,11 @@ impl Stage1Parse<int8x16_t> for SimdInput {
178
182
// needs to be large enough to handle this
179
183
//TODO: usize was u32 here does this matter?
180
184
#[ cfg_attr( not( feature = "no-inline" ) , inline( always) ) ]
181
- #[ allow( clippy:: cast_possible_wrap, clippy:: cast_ptr_alignment) ]
185
+ #[ allow(
186
+ clippy:: cast_possible_wrap,
187
+ clippy:: cast_ptr_alignment,
188
+ clippy:: uninit_vec
189
+ ) ]
182
190
fn flatten_bits ( base : & mut Vec < u32 > , idx : u32 , mut bits : u64 ) {
183
191
let cnt: usize = bits. count_ones ( ) as usize ;
184
192
let mut l = base. len ( ) ;
@@ -215,7 +223,7 @@ impl Stage1Parse<int8x16_t> for SimdInput {
215
223
216
224
let v: int32x4_t = mem:: transmute ( [ v0, v1, v2, v3] ) ;
217
225
let v: int32x4_t = vaddq_s32 ( idx_64_v, v) ;
218
- std:: ptr:: write ( base. as_mut_ptr ( ) . add ( l) as * mut int32x4_t , v) ;
226
+ std:: ptr:: write ( base. as_mut_ptr ( ) . add ( l) . cast :: < int32x4_t > ( ) , v) ;
219
227
}
220
228
l += 4 ;
221
229
}
0 commit comments