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 11[package ]
22name = " core_simd"
33version = " 0.1.0"
4- edition = " 2018 "
4+ edition = " 2021 "
55homepage = " https://github.com/rust-lang/portable-simd"
66repository = " https://github.com/rust-lang/portable-simd"
77keywords = [" core" , " simd" , " intrinsics" ]
Original file line number Diff line number Diff line change 1111) ]
1212#![ cfg_attr( feature = "generic_const_exprs" , feature( generic_const_exprs) ) ]
1313#![ warn( missing_docs) ]
14+ #![ deny( unsafe_op_in_unsafe_fn) ]
1415#![ unstable( feature = "portable_simd" , issue = "86656" ) ]
1516//! Portable SIMD module.
1617
Original file line number Diff line number Diff line change @@ -118,7 +118,7 @@ where
118118 /// All lanes must be either 0 or -1.
119119 #[ inline]
120120 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) ) }
122122 }
123123
124124 /// Converts a vector of integers to a mask, where 0 represents `false` and -1
@@ -145,7 +145,7 @@ where
145145 /// `lane` must be less than `LANES`.
146146 #[ inline]
147147 pub unsafe fn test_unchecked ( & self , lane : usize ) -> bool {
148- self . 0 . test_unchecked ( lane)
148+ unsafe { self . 0 . test_unchecked ( lane) }
149149 }
150150
151151 /// Tests the value of the specified lane.
@@ -164,7 +164,9 @@ where
164164 /// `lane` must be less than `LANES`.
165165 #[ inline]
166166 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+ }
168170 }
169171
170172 /// Sets the value of the specified lane.
Original file line number Diff line number Diff line change 9393
9494 #[ inline]
9595 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+ }
9799 }
98100
99101 #[ inline]
@@ -112,9 +114,11 @@ where
112114 core:: mem:: size_of:: <<LaneCount :: <LANES > as SupportedLaneCount >:: BitMask >( ) ,
113115 core:: mem:: size_of:: <<LaneCount :: <LANES > as SupportedLaneCount >:: IntBitMask >( ) ,
114116 ) ;
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+ }
118122 }
119123
120124 #[ cfg( feature = "generic_const_exprs" ) ]
Original file line number Diff line number Diff line change @@ -61,7 +61,7 @@ macro_rules! implement {
6161 /// * Be representable in the return type, after truncating off its fractional part
6262 #[ inline]
6363 pub unsafe fn to_int_unchecked( self ) -> Simd <$int_type, LANES > {
64- intrinsics:: simd_cast( self )
64+ unsafe { intrinsics:: simd_cast( self ) }
6565 }
6666
6767 /// Creates a floating-point vector from an integer vector. Rounds values that are
Original file line number Diff line number Diff line change 11[package ]
22name = " test_helpers"
33version = " 0.1.0"
4- edition = " 2018 "
4+ edition = " 2021 "
55publish = false
66
77[dependencies .proptest ]
You can’t perform that action at this time.
0 commit comments