! (c)Joe Groff bsd license USING: accessors alien.c-types classes.struct kernel locals math.vectors math.vectors.simd sequences sequences.private ; SIMD: float IN: math.matrices.simd STRUCT: matrix4 { rows float-4[4] } ; M: matrix4 length drop 4 ; inline M: matrix4 nth-unsafe rows>> nth-unsafe ; inline M: matrix4 set-nth-unsafe immutable ; inline M: matrix4 new-sequence 2drop matrix4 (struct) ; inline c a rows>> first :> a1 a rows>> second :> a2 a rows>> third :> a3 a rows>> fourth :> a4 b rows>> first :> b1 b rows>> second :> b2 b rows>> third :> b3 b rows>> fourth :> b4 a1 b1 quot call :> c1 a2 b2 quot call :> c2 a3 b3 quot call :> c3 a4 b4 quot call :> c4 c1 c rows>> set-first c2 c rows>> set-second c3 c rows>> set-third c4 c rows>> set-fourth c ; inline PRIVATE> TYPED: m4+ ( a: matrix4 b: matrix4 -- c: matrix4 ) [ v+ ] 2map-rows ; TYPED: m4- ( a: matrix4 b: matrix4 -- c: matrix4 ) [ v- ] 2map-rows ;