|
2 | 2 |
|
3 | 3 | use super::MaskElement; |
4 | 4 | use crate::simd::intrinsics; |
5 | | -use crate::simd::{LaneCount, Simd, SupportedLaneCount, ToBitMask, ToBitMaskArray}; |
| 5 | +use crate::simd::{LaneCount, Simd, SupportedLaneCount, ToBitMask}; |
6 | 6 |
|
7 | 7 | #[repr(transparent)] |
8 | 8 | pub struct Mask<T, const LANES: usize>(Simd<T, LANES>) |
@@ -126,72 +126,6 @@ where |
126 | 126 | unsafe { Mask(intrinsics::simd_cast(self.0)) } |
127 | 127 | } |
128 | 128 |
|
129 | | - #[inline] |
130 | | - #[must_use = "method returns a new array and does not mutate the original value"] |
131 | | - pub fn to_bitmask_array<const N: usize>(self) -> [u8; N] |
132 | | - where |
133 | | - super::Mask<T, LANES>: ToBitMaskArray, |
134 | | - [(); <super::Mask<T, LANES> as ToBitMaskArray>::BYTES]: Sized, |
135 | | - { |
136 | | - assert_eq!(<super::Mask<T, LANES> as ToBitMaskArray>::BYTES, N); |
137 | | - |
138 | | - // Safety: N is the correct bitmask size |
139 | | - // |
140 | | - // The transmute below allows this function to be marked safe, since it will prevent |
141 | | - // monomorphization errors in the case of an incorrect size. |
142 | | - unsafe { |
143 | | - // Compute the bitmask |
144 | | - let bitmask: [u8; <super::Mask<T, LANES> as ToBitMaskArray>::BYTES] = |
145 | | - intrinsics::simd_bitmask(self.0); |
146 | | - |
147 | | - // Transmute to the return type, previously asserted to be the same size |
148 | | - let mut bitmask: [u8; N] = core::mem::transmute_copy(&bitmask); |
149 | | - |
150 | | - // LLVM assumes bit order should match endianness |
151 | | - if cfg!(target_endian = "big") { |
152 | | - for x in bitmask.as_mut() { |
153 | | - *x = x.reverse_bits(); |
154 | | - } |
155 | | - } |
156 | | - |
157 | | - bitmask |
158 | | - } |
159 | | - } |
160 | | - |
161 | | - #[inline] |
162 | | - #[must_use = "method returns a new mask and does not mutate the original value"] |
163 | | - pub fn from_bitmask_array<const N: usize>(mut bitmask: [u8; N]) -> Self |
164 | | - where |
165 | | - super::Mask<T, LANES>: ToBitMaskArray, |
166 | | - [(); <super::Mask<T, LANES> as ToBitMaskArray>::BYTES]: Sized, |
167 | | - { |
168 | | - assert_eq!(<super::Mask<T, LANES> as ToBitMaskArray>::BYTES, N); |
169 | | - |
170 | | - // Safety: N is the correct bitmask size |
171 | | - // |
172 | | - // The transmute below allows this function to be marked safe, since it will prevent |
173 | | - // monomorphization errors in the case of an incorrect size. |
174 | | - unsafe { |
175 | | - // LLVM assumes bit order should match endianness |
176 | | - if cfg!(target_endian = "big") { |
177 | | - for x in bitmask.as_mut() { |
178 | | - *x = x.reverse_bits(); |
179 | | - } |
180 | | - } |
181 | | - |
182 | | - // Transmute to the bitmask type, previously asserted to be the same size |
183 | | - let bitmask: [u8; <super::Mask<T, LANES> as ToBitMaskArray>::BYTES] = |
184 | | - core::mem::transmute_copy(&bitmask); |
185 | | - |
186 | | - // Compute the regular mask |
187 | | - Self::from_int_unchecked(intrinsics::simd_select_bitmask( |
188 | | - bitmask, |
189 | | - Self::splat(true).to_int(), |
190 | | - Self::splat(false).to_int(), |
191 | | - )) |
192 | | - } |
193 | | - } |
194 | | - |
195 | 129 | #[inline] |
196 | 130 | pub(crate) fn to_bitmask_integer<U: ReverseBits>(self) -> U |
197 | 131 | where |
|
0 commit comments