Packages
·
v0.0.13
simd
Float geometry plus integer-widening lane operations. Four modules:
simd/vec3—Vec3(with a lane-3-zero invariant):dot,cross,length,normalize,reflect,refract,lerp,clamp, and more.simd/vec4— a full 4-lane vector withraw()/from_raw()for matrix code.simd/mat4x4— a column-major[Vec4; 4]withmul_vec(fourfma <4 x float>ops) andmul.simd/integer— integer-widening lane helpers built from the compiler's Tier-1 SIMD primitives (widen/low/high/swizzle): widening multiply, multiply-accumulate, pairwise add, anddot_i32, a 16-lane signed-byte dot product accumulated ini32. This is the lane surface quantized kernels build on.
import "simd/vec3" as vec3;
let a = vec3::Vec3::new(1.0f32, 2.0f32, 3.0f32);
let b = vec3::Vec3::new(4.0f32, 5.0f32, 6.0f32);
let d: f32 = a.dot(b); // 32.0
let c = a.cross(b); // (-3, 6, -3)
Use these when the SIMD shape should be visible at the source level. On Apple Silicon the scalar FMA codegen can beat explicit Vec3 SIMD when the 4th lane is wasted, so measure before betting on SIMD types.