export function mul_m22v2_aos ( out , mat , vec , num ) { const res = out ; num >>= 1 ; const m0 = v128 . load ( mat ) ; const m1 = v128 . shuffle < f32 > ( m0 , m0 , 0 , 1 , 0 , 1 ) ; const m2 = v128 . shuffle < f32 > ( m0 , m0 , 2 , 3 , 2 , 3 ) ; for ( ; num -- > 0 ; ) { const v = v128 . load ( vec ) ; v128 . store ( out , f32x4 . add ( f32x4 . mul ( v128 . shuffle < f32 > ( v , v , 0 , 0 , 2 , 2 ) , m1 ) , f32x4 . mul ( v128 . shuffle < f32 > ( v , v , 1 , 1 , 3 , 3 ) , m2 ) ) ) ; out += 16 ; vec += 16 ; } return res ; } export function mul_m23v2_aos ( out , mat , vec , num ) { const res = out ; num >>= 1 ; const m0 = v128 . load ( mat ) ; const m1 = v128 . shuffle < f32 > ( m0 , m0 , 0 , 1 , 0 , 1 ) ; const m2 = v128 . shuffle < f32 > ( m0 , m0 , 2 , 3 , 2 , 3 ) ; let m3 = v128 . load ( mat , 16 ) ; m3 = v128 . shuffle < f32 > ( m3 , m3 , 0 , 1 , 0 , 1 ) ; for ( ; num -- > 0 ; ) { const v = v128 . load ( vec ) ; v128 . store ( out , f32x4 . add ( f32x4 . add ( f32x4 . mul ( v128 . shuffle < f32 > ( v , v , 0 , 0 , 2 , 2 ) , m1 ) , f32x4 . mul ( v128 . shuffle < f32 > ( v , v , 1 , 1 , 3 , 3 ) , m2 ) ) , m3 ) ) ; out += 16 ; vec += 16 ; } return res ; } export function mul_m44v4_aos ( out , mat , vec , num , so , sa ) { so <<= 2 ; sa <<= 2 ; const res = out ; const m0 = v128 . load ( mat ) ; const m1 = v128 . load ( mat , 16 ) ; const m2 = v128 . load ( mat , 32 ) ; const m3 = v128 . load ( mat , 48 ) ; for ( ; num -- > 0 ; ) { const v = v128 . load ( vec ) ; v128 . store ( out , f32x4 . add ( f32x4 . add ( f32x4 . mul ( v128 . shuffle < f32 > ( v , v , 0 , 0 , 0 , 0 ) , m0 ) , f32x4 . mul ( v128 . shuffle < f32 > ( v , v , 1 , 1 , 1 , 1 ) , m1 ) ) , f32x4 . add ( f32x4 . mul ( v128 . shuffle < f32 > ( v , v , 2 , 2 , 2 , 2 ) , m2 ) , f32x4 . mul ( v128 . shuffle < f32 > ( v , v , 3 , 3 , 3 , 3 ) , m3 ) ) ) ) ; out += so ; vec += sa ; } return res ; }