Replace mem::transmute() with pointer casts
And fix erroneous #[cfg]
This commit is contained in:
parent
a3c4dbca95
commit
491903e1de
@ -14,9 +14,6 @@ use base::dimension::{U2, U3};
|
||||
use std::convert::{AsMut, AsRef, From, Into};
|
||||
#[cfg(feature = "mint")]
|
||||
use base::storage::{Storage, StorageMut};
|
||||
#[cfg(feature = "mint")]
|
||||
use std::mem;
|
||||
|
||||
/*
|
||||
* This file provides the following conversions:
|
||||
* =============================================
|
||||
@ -110,7 +107,7 @@ macro_rules! impl_from_into_mint_1D(
|
||||
#[inline]
|
||||
fn as_ref(&self) -> &mint::$PT<N> {
|
||||
unsafe {
|
||||
mem::transmute(self.coords.data.ptr())
|
||||
&*(self.coords.data.ptr() as *const mint::$PT<N>)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -120,7 +117,7 @@ macro_rules! impl_from_into_mint_1D(
|
||||
#[inline]
|
||||
fn as_mut(&mut self) -> &mut mint::$PT<N> {
|
||||
unsafe {
|
||||
mem::transmute(self.coords.data.ptr_mut())
|
||||
&mut *(self.coords.data.ptr_mut() as *mut mint::$PT<N>)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user