Trait simd::Bitcast [−] [src]

pub unsafe trait Bitcast<Out> {
    fn bitcast(self) -> Out;
}

Types between which a direct bitcast (transmute) is safe, e.g. reinterpreting the 4 bytes of a u32 as an i32 is fine.

This can and will cause serious brokenness if Self and Out are different sizes, and equally serious brokenness if there are values of type Self where the bit pattern is not a valid value of type Out.

NB. there's no static guarantee that pointers to bitcastable types are themselves bitcastable, as the alignment may not be correct.

Required Methods

fn bitcast(self) -> Out

Bitcast self into a value of type Out.

This should be the same as transmute::<_, Out>(self), but is safe.

Implementors