Fix building with SIMD enabled
This commit is contained in:
parent
a6abd5bf02
commit
bd1b2667bd
1 changed files with 8 additions and 2 deletions
|
@ -347,8 +347,14 @@ macro_rules! impl_vector_default {
|
|||
impl<S: NumCast + Copy> $VectorN<S> {
|
||||
/// Component-wise casting to another type.
|
||||
#[inline]
|
||||
pub fn cast<T: NumCast>(&self) -> $VectorN<T> {
|
||||
$VectorN { $($field: NumCast::from(self.$field).unwrap()),+ }
|
||||
pub fn cast<T: NumCast>(&self) -> Option<$VectorN<T>> {
|
||||
$(
|
||||
let $field = match NumCast::from(self.$field) {
|
||||
Some(field) => field,
|
||||
None => return None
|
||||
};
|
||||
)+
|
||||
Some($VectorN { $($field),+ })
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue