Skip to main content

luaur_compiler/functions/
cvector.rs

1use crate::enums::type_constant_folding::Type;
2use crate::records::constant::Constant;
3
4pub(crate) fn cvector(x: f64, y: f64, z: f64, w: f64) -> Constant {
5    let mut res = Constant {
6        r#type: Type::Type_Vector,
7        string_length: 0,
8        data: unsafe { core::mem::zeroed() },
9    };
10
11    unsafe {
12        res.data.value_vector[0] = x as f32;
13        res.data.value_vector[1] = y as f32;
14        res.data.value_vector[2] = z as f32;
15        res.data.value_vector[3] = w as f32;
16    }
17
18    res
19}