about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJubilee Young <workingjubilee@gmail.com>2022-03-02 20:09:01 -0800
committerCaleb Zulawski <caleb.zulawski@gmail.com>2022-05-21 15:13:33 -0400
commit98cd636d581962c29ca336ca89dce083dbed926f (patch)
treeaa52ef8c700c53a9df75410e1042191564f1f379
parentaf53b5de24712a29f952b657d6e3107ba32f6e67 (diff)
downloadrust-98cd636d581962c29ca336ca89dce083dbed926f.tar.gz
rust-98cd636d581962c29ca336ca89dce083dbed926f.zip
Add Mask::cast
-rw-r--r--crates/core_simd/src/masks.rs7
1 files changed, 7 insertions, 0 deletions
diff --git a/crates/core_simd/src/masks.rs b/crates/core_simd/src/masks.rs
index e8962b86b11..8f2f3f6aee0 100644
--- a/crates/core_simd/src/masks.rs
+++ b/crates/core_simd/src/masks.rs
@@ -181,6 +181,13 @@ where
         self.0.to_int()
     }
 
+    /// Converts the mask to a mask of any other lane size.
+    #[inline]
+    #[must_use = "method returns a new mask and does not mutate the original value"]
+    pub fn cast<U: MaskElement>(self) -> Mask<U, LANES> {
+        Mask(self.0.convert())
+    }
+
     /// Tests the value of the specified lane.
     ///
     /// # Safety