| 1 | use widerust-analyzer cargo wide 1.6.1 crate/::{f32x4rust-analyzer cargo wide 1.6.1 f32x4_/f32x4#, f32x8rust-analyzer cargo wide 1.6.1 f32x8_/f32x8#, f64x2rust-analyzer cargo wide 1.6.1 f64x2_/f64x2#, f64x4rust-analyzer cargo wide 1.6.1 f64x4_/f64x4#}; |
| 2 | |
| 3 | use superrust-analyzer cargo palette 0.7.6 bool_mask/::{BoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/BoolMask#, HasBoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/HasBoolMask#, LazySelectrust-analyzer cargo palette 0.7.6 bool_mask/LazySelect#, Selectrust-analyzer cargo palette 0.7.6 bool_mask/Select#}; |
| 4 | |
| 5 | macro_rules! impl_wide_bool_maskrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl_wide_bool_mask! { |
| 6 | ($($ty: ident: ($scalar: ident, $uint: ident)),+) => { |
| 7 | $( |
| 8 | impl BoolMask for $ty { |
| 9 | #[inline] |
| 10 | fn from_bool(value: bool) -> Self { |
| 11 | $ty::splat(if value { $scalar::from_bits($uint::MAX) } else { 0.0 }) |
| 12 | } |
| 13 | |
| 14 | #[inline] |
| 15 | fn is_true(&self) -> bool { |
| 16 | self.all() |
| 17 | } |
| 18 | |
| 19 | #[inline] |
| 20 | fn is_false(&self) -> bool { |
| 21 | self.none() |
| 22 | } |
| 23 | } |
| 24 | |
| 25 | impl HasBoolMask for $ty { |
| 26 | type Mask = Self; |
| 27 | } |
| 28 | |
| 29 | impl Select<Self> for $ty { |
| 30 | #[inline] |
| 31 | fn select(self, a: Self, b: Self) -> Self { |
| 32 | self.blend(a, b) |
| 33 | } |
| 34 | } |
| 35 | |
| 36 | impl LazySelect<Self> for $ty { |
| 37 | #[inline] |
| 38 | fn lazy_select<A, B>(self, a: A, b: B) -> Self |
| 39 | where |
| 40 | A: FnOnce() -> Self, |
| 41 | B: FnOnce() -> Self, |
| 42 | { |
| 43 | let a = a(); |
| 44 | let b = b(); |
| 45 | |
| 46 | self.select(a, b) |
| 47 | } |
| 48 | } |
| 49 | )+ |
| 50 | }; |
| 51 | } |
| 52 | |
| 53 | impl_wide_bool_maskrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl_wide_bool_mask!!( |
| 54 | f32x4rust-analyzer cargo wide 1.6.1 f32x4_/f32x4#: (f32, u32), |
| 55 | f32x8rust-analyzer cargo wide 1.6.1 f32x8_/f32x8#: (f32, u32), |
| 56 | f64x2rust-analyzer cargo wide 1.6.1 f64x2_/f64x2#: (f64, u64), |
| 57 | f64x4rust-analyzer cargo wide 1.6.1 f64x4_/f64x4#: (f64, u64) |
| 58 | ); |
| 59 | |
| 60 | #[cfg(test)] |
| 61 | mod testrust-analyzer cargo palette 0.7.6 bool_mask/wide/test/ { |
| 62 | use widerust-analyzer cargo wide 1.6.1 crate/::{f32x4rust-analyzer cargo wide 1.6.1 f32x4_/f32x4#, f32x8rust-analyzer cargo wide 1.6.1 f32x8_/f32x8#, f64x2rust-analyzer cargo wide 1.6.1 f64x2_/f64x2#, f64x4rust-analyzer cargo wide 1.6.1 f64x4_/f64x4#}; |
| 63 | |
| 64 | use craterust-analyzer cargo palette 0.7.6 crate/::bool_maskrust-analyzer cargo palette 0.7.6 bool_mask/::BoolMaskrust-analyzer cargo palette 0.7.6 bool_mask/BoolMask#; |
| 65 | |
| 66 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 67 | fn from_truerust-analyzer cargo palette 0.7.6 bool_mask/wide/test/from_true().() { |
| 68 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f32x4rust-analyzer cargo wide 1.6.1 f32x4_/f32x4#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x4][BoolMask]from_bool().(true).is_truerust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x4][BoolMask]is_true().()); |
| 69 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f32x4rust-analyzer cargo wide 1.6.1 f32x4_/f32x4#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x4][BoolMask]from_bool().(true).is_falserust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x4][BoolMask]is_false().()); |
| 70 | |
| 71 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f32x8rust-analyzer cargo wide 1.6.1 f32x8_/f32x8#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x8][BoolMask]from_bool().(true).is_truerust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x8][BoolMask]is_true().()); |
| 72 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f32x8rust-analyzer cargo wide 1.6.1 f32x8_/f32x8#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x8][BoolMask]from_bool().(true).is_falserust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x8][BoolMask]is_false().()); |
| 73 | |
| 74 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f64x2rust-analyzer cargo wide 1.6.1 f64x2_/f64x2#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x2][BoolMask]from_bool().(true).is_truerust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x2][BoolMask]is_true().()); |
| 75 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f64x2rust-analyzer cargo wide 1.6.1 f64x2_/f64x2#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x2][BoolMask]from_bool().(true).is_falserust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x2][BoolMask]is_false().()); |
| 76 | |
| 77 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f64x4rust-analyzer cargo wide 1.6.1 f64x4_/f64x4#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x4][BoolMask]from_bool().(true).is_truerust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x4][BoolMask]is_true().()); |
| 78 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f64x4rust-analyzer cargo wide 1.6.1 f64x4_/f64x4#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x4][BoolMask]from_bool().(true).is_falserust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x4][BoolMask]is_false().()); |
| 79 | } |
| 80 | |
| 81 | #[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 82 | fn from_falserust-analyzer cargo palette 0.7.6 bool_mask/wide/test/from_false().() { |
| 83 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f32x4rust-analyzer cargo wide 1.6.1 f32x4_/f32x4#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x4][BoolMask]from_bool().(false).is_falserust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x4][BoolMask]is_false().()); |
| 84 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f32x4rust-analyzer cargo wide 1.6.1 f32x4_/f32x4#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x4][BoolMask]from_bool().(false).is_truerust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x4][BoolMask]is_true().()); |
| 85 | |
| 86 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f32x8rust-analyzer cargo wide 1.6.1 f32x8_/f32x8#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x8][BoolMask]from_bool().(false).is_falserust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x8][BoolMask]is_false().()); |
| 87 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f32x8rust-analyzer cargo wide 1.6.1 f32x8_/f32x8#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x8][BoolMask]from_bool().(false).is_truerust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f32x8][BoolMask]is_true().()); |
| 88 | |
| 89 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f64x2rust-analyzer cargo wide 1.6.1 f64x2_/f64x2#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x2][BoolMask]from_bool().(false).is_falserust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x2][BoolMask]is_false().()); |
| 90 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f64x2rust-analyzer cargo wide 1.6.1 f64x2_/f64x2#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x2][BoolMask]from_bool().(false).is_truerust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x2][BoolMask]is_true().()); |
| 91 | |
| 92 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(f64x4rust-analyzer cargo wide 1.6.1 f64x4_/f64x4#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x4][BoolMask]from_bool().(false).is_falserust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x4][BoolMask]is_false().()); |
| 93 | assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().f64x4rust-analyzer cargo wide 1.6.1 f64x4_/f64x4#::from_boolrust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x4][BoolMask]from_bool().(false).is_truerust-analyzer cargo palette 0.7.6 bool_mask/wide/impl#[f64x4][BoolMask]is_true().()); |
| 94 | } |
| 95 | } |