/
d.vision
/
division_math
Обзор
Документация
Войти
/
d.vision
/
division_math
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/vector4.rs
75 строк
1 KB
d.vision
Added const to functions
31 июл 2025, 10:36
31 июл 2025, 10:36
047b825
Код
Авторство
О чём код?
#[repr(C)] #[derive(PartialEq, Copy, Clone, Debug)] pub struct Vector4 { pub x: f32, pub y: f32, pub z: f32, pub w: f32, } impl Vector4 { #[inline] pub fn dot(l: Vector4, r: Vector4) -> f32 { l.x * r.x + l.y * r.y + l.z * r.z + l.w * r.w } } #[cfg(feature = "enable_simd")] impl std::ops::Add<Vector4> for Vector4 { type Output = Vector4; #[inline] fn add(self, rhs: Vector4) -> Vector4 { Vector4::add_simd(self, rhs) } } #[cfg(feature = "enable_simd")] impl std::ops::Sub<Vector4> for Vector4 { type Output = Vector4; #[inline] fn sub(self, rhs: Vector4) -> Vector4 { Vector4::sub_simd(self, rhs) } } #[cfg(feature = "enable_simd")] impl std::ops::Mul<Vector4> for Vector4 { type Output = Vector4; #[inline] fn mul(self, rhs: Vector4) -> Vector4 { Vector4::mul_simd(self, rhs) } } #[cfg(feature = "enable_simd")] impl std::ops::Mul<f32> for Vector4 { type Output = Vector4; #[inline] fn mul(self, rhs: f32) -> Self::Output { Vector4::mul_scalar_simd(self, rhs) } } #[cfg(feature = "enable_simd")] impl std::ops::Div<Vector4> for Vector4 { type Output = Vector4; #[inline] fn div(self, rhs: Vector4) -> Self::Output { Vector4::div_simd(self, rhs) } } #[cfg(feature = "enable_simd")] impl std::ops::Div<f32> for Vector4 { type Output = Vector4; #[inline] fn div(self, rhs: f32) -> Self::Output { Vector4::div_scalar_simd(self, rhs) } }