File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
crates/core_simd/src/masks/full_masks Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,13 @@ macro_rules! define_mask {
2222 impl <const $lanes: usize > $name<$lanes> {
2323 /// Construct a mask by setting all lanes to the given value.
2424 pub fn splat( value: bool ) -> Self {
25- Self ( <$type>:: splat( value. into( ) ) )
25+ Self ( <$type>:: splat(
26+ if value {
27+ -1
28+ } else {
29+ 0
30+ }
31+ ) )
2632 }
2733
2834 /// Tests the value of the specified lane.
@@ -31,7 +37,7 @@ macro_rules! define_mask {
3137 /// Panics if `lane` is greater than or equal to the number of lanes in the vector.
3238 #[ inline]
3339 pub fn test( & self , lane: usize ) -> bool {
34- self . 0 [ lane] > 0
40+ self . 0 [ lane] == - 1
3541 }
3642
3743 /// Sets the value of the specified lane.
@@ -41,7 +47,7 @@ macro_rules! define_mask {
4147 #[ inline]
4248 pub fn set( & mut self , lane: usize , value: bool ) {
4349 self . 0 [ lane] = if value {
44- ! 0
50+ - 1
4551 } else {
4652 0
4753 }
@@ -57,7 +63,7 @@ macro_rules! define_mask {
5763 impl <const $lanes: usize > core:: convert:: TryFrom <$type> for $name<$lanes> {
5864 type Error = TryFromMaskError ;
5965 fn try_from( value: $type) -> Result <Self , Self :: Error > {
60- if value. as_slice( ) . iter( ) . all( |x| * x == 0 || ! * x == 0 ) {
66+ if value. as_slice( ) . iter( ) . all( |x| * x == 0 || * x == - 1 ) {
6167 Ok ( Self ( value) )
6268 } else {
6369 Err ( TryFromMaskError ( ( ) ) )
You can’t perform that action at this time.
0 commit comments