File tree Expand file tree Collapse file tree 6 files changed +17
-10
lines changed Expand file tree Collapse file tree 6 files changed +17
-10
lines changed Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " core_simd"
3
3
version = " 0.1.0"
4
- edition = " 2018 "
4
+ edition = " 2021 "
5
5
homepage = " https://github.com/rust-lang/portable-simd"
6
6
repository = " https://github.com/rust-lang/portable-simd"
7
7
keywords = [" core" , " simd" , " intrinsics" ]
Original file line number Diff line number Diff line change 11
11
) ]
12
12
#![ cfg_attr( feature = "generic_const_exprs" , feature( generic_const_exprs) ) ]
13
13
#![ warn( missing_docs) ]
14
+ #![ deny( unsafe_op_in_unsafe_fn) ]
14
15
#![ unstable( feature = "portable_simd" , issue = "86656" ) ]
15
16
//! Portable SIMD module.
16
17
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ where
118
118
/// All lanes must be either 0 or -1.
119
119
#[ inline]
120
120
pub unsafe fn from_int_unchecked ( value : Simd < T , LANES > ) -> Self {
121
- Self ( mask_impl:: Mask :: from_int_unchecked ( value) )
121
+ unsafe { Self ( mask_impl:: Mask :: from_int_unchecked ( value) ) }
122
122
}
123
123
124
124
/// Converts a vector of integers to a mask, where 0 represents `false` and -1
@@ -145,7 +145,7 @@ where
145
145
/// `lane` must be less than `LANES`.
146
146
#[ inline]
147
147
pub unsafe fn test_unchecked ( & self , lane : usize ) -> bool {
148
- self . 0 . test_unchecked ( lane)
148
+ unsafe { self . 0 . test_unchecked ( lane) }
149
149
}
150
150
151
151
/// Tests the value of the specified lane.
@@ -164,7 +164,9 @@ where
164
164
/// `lane` must be less than `LANES`.
165
165
#[ inline]
166
166
pub unsafe fn set_unchecked ( & mut self , lane : usize , value : bool ) {
167
- self . 0 . set_unchecked ( lane, value) ;
167
+ unsafe {
168
+ self . 0 . set_unchecked ( lane, value) ;
169
+ }
168
170
}
169
171
170
172
/// Sets the value of the specified lane.
Original file line number Diff line number Diff line change 93
93
94
94
#[ inline]
95
95
pub unsafe fn set_unchecked ( & mut self , lane : usize , value : bool ) {
96
- self . 0 . as_mut ( ) [ lane / 8 ] ^= ( ( value ^ self . test_unchecked ( lane) ) as u8 ) << ( lane % 8 )
96
+ unsafe {
97
+ self . 0 . as_mut ( ) [ lane / 8 ] ^= ( ( value ^ self . test_unchecked ( lane) ) as u8 ) << ( lane % 8 )
98
+ }
97
99
}
98
100
99
101
#[ inline]
@@ -112,9 +114,11 @@ where
112
114
core:: mem:: size_of:: <<LaneCount :: <LANES > as SupportedLaneCount >:: BitMask >( ) ,
113
115
core:: mem:: size_of:: <<LaneCount :: <LANES > as SupportedLaneCount >:: IntBitMask >( ) ,
114
116
) ;
115
- let mask: <LaneCount < LANES > as SupportedLaneCount >:: IntBitMask =
116
- intrinsics:: simd_bitmask ( value) ;
117
- Self ( core:: mem:: transmute_copy ( & mask) , PhantomData )
117
+ unsafe {
118
+ let mask: <LaneCount < LANES > as SupportedLaneCount >:: IntBitMask =
119
+ intrinsics:: simd_bitmask ( value) ;
120
+ Self ( core:: mem:: transmute_copy ( & mask) , PhantomData )
121
+ }
118
122
}
119
123
120
124
#[ cfg( feature = "generic_const_exprs" ) ]
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ macro_rules! implement {
61
61
/// * Be representable in the return type, after truncating off its fractional part
62
62
#[ inline]
63
63
pub unsafe fn to_int_unchecked( self ) -> Simd <$int_type, LANES > {
64
- intrinsics:: simd_cast( self )
64
+ unsafe { intrinsics:: simd_cast( self ) }
65
65
}
66
66
67
67
/// Creates a floating-point vector from an integer vector. Rounds values that are
Original file line number Diff line number Diff line change 1
1
[package ]
2
2
name = " test_helpers"
3
3
version = " 0.1.0"
4
- edition = " 2018 "
4
+ edition = " 2021 "
5
5
publish = false
6
6
7
7
[dependencies .proptest ]
You can’t perform that action at this time.
0 commit comments