Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use std::convert::TryInto;
- pub fn convert0(t: &[f32; 4]) -> &[f32; 3] {
- t[0..3].try_into().unwrap()
- }
- pub fn convert1(t: &[f32; 4]) -> &[f32; 3] {
- t[0..3].try_into().unwrap_or_else(|_| unsafe { std::hint::unreachable_unchecked() })
- }
- pub fn convert2(t: &[f32; 4]) -> &[f32; 3] {
- unsafe { std::mem::transmute::<&[f32; 4], &[f32; 3]>(t) }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement