]> gitweb.factorcode.org Git - factor.git/blobdiff - basis/math/vectors/simd/simd.factor
factor: trim using lists
[factor.git] / basis / math / vectors / simd / simd.factor
index 90ccfcaf09d8df032ed1ae5cadf9735828d45de6..7870ed8db619eece9d06307477f9059fff7ae41e 100644 (file)
@@ -1,10 +1,9 @@
 USING: accessors alien arrays byte-arrays classes combinators
-cpu.architecture effects fry functors generalizations generic
-generic.parser kernel lexer literals locals macros math math.functions
-math.vectors math.vectors.private math.vectors.simd.intrinsics
-namespaces parser prettyprint.custom quotations sequences
-sequences.generalizations sequences.private vocabs vocabs.loader
-words math.bitwise ;
+cpu.architecture effects functors generalizations kernel lexer
+literals math math.bitwise math.vectors
+math.vectors.simd.intrinsics parser prettyprint.custom
+quotations sequences sequences.generalizations sequences.private
+vocabs.loader words ;
 QUALIFIED-WITH: alien.c-types c
 IN: math.vectors.simd
 
@@ -94,7 +93,7 @@ DEFER: simd-construct-op
 
 : (vvx->v-op) ( a b obj rep quot: ( (a) (b) obj rep -- (c) ) -- c )
     [ [ simd-unbox ] [ underlying>> ] bi* ] 3dip 2curry 2curry make-underlying ; inline
-    
+
 : vv->v-op ( a b rep quot: ( (a) (b) rep -- (c) ) fallback-quot -- c )
     [ '[ _ (vv->v-op) ] ] [ '[ drop @ ] ] bi* if-both-vectors-match ; inline
 
@@ -138,7 +137,7 @@ M: simd-128 byte-length drop 16 ; inline
 M: simd-128 new-sequence
     2dup length =
     [ nip [ 16 (byte-array) ] make-underlying ]
-    [ length throw-bad-simd-length ] if ; inline
+    [ length bad-simd-length ] if ; inline
 
 M: simd-128 equal?
     dup simd-rep [ drop v= vall? ] [ 3drop f ] if-both-vectors-match ; inline
@@ -171,8 +170,8 @@ M: simd-128 vmin
     dup simd-rep [ (simd-vmin) ] [ call-next-method ] vv->v-op ; inline
 M: simd-128 vmax
     dup simd-rep [ (simd-vmax) ] [ call-next-method ] vv->v-op ; inline
-M: simd-128 v.
-    dup simd-rep [ (simd-v.) ] [ call-next-method ] vv->x-op ; inline
+M: simd-128 vdot
+    dup simd-rep [ (simd-vdot) ] [ call-next-method ] vv->x-op ; inline
 M: simd-128 vsad
     dup simd-rep [ (simd-vsad) ] [ call-next-method ] vv->x-op ; inline
 M: simd-128 vsqrt
@@ -253,7 +252,7 @@ M: simd-128 v+n over simd-with v+ ; inline
 M: simd-128 v-n over simd-with v- ; inline
 M: simd-128 v*n over simd-with v* ; inline
 M: simd-128 v/n over simd-with v/ ; inline
-M: simd-128 norm-sq dup v. assert-positive ; inline
+M: simd-128 norm-sq dup vdot assert-positive ; inline
 M: simd-128 distance v- norm ; inline
 
 M: simd-128 >pprint-sequence ;
@@ -263,7 +262,7 @@ M: simd-128 pprint* pprint-object ;
 
 ! SIMD concrete type functor
 
-FUNCTOR: define-simd-128 ( T -- )
+<FUNCTOR: define-simd-128 ( T -- )
 
 A      DEFINES-CLASS ${T}
 A-rep  IS            ${T}-rep
@@ -321,7 +320,7 @@ c:<c-type>
     A >>boxed-class
     { A-rep alien-vector A boa } >quotation >>getter
     {
-        [ dup simd-128? [ throw-bad-simd-vector ] unless underlying>> ] 2dip
+        [ dup simd-128? [ bad-simd-vector ] unless underlying>> ] 2dip
         A-rep set-alien-vector
     } >quotation >>setter
     16 >>size
@@ -329,7 +328,7 @@ c:<c-type>
     A-rep >>rep
 \ A c:typedef
 
-;FUNCTOR
+;FUNCTOR>
 
 SYNTAX: SIMD-128:
     scan-token define-simd-128 ;
@@ -353,7 +352,7 @@ SIMD-128: double-2
 
 ! misc
 
-M: simd-128 vshuffle ( u perm -- v )
+M: simd-128 vshuffle
     vshuffle-bytes ; inline
 
 M: uchar-16 v*hs+