]> gitweb.factorcode.org Git - factor.git/commitdiff
Merge branch 'master' of git://factorcode.org/git/factor
authorSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 27 Sep 2009 22:18:16 +0000 (17:18 -0500)
committerSlava Pestov <slava@slava-pestovs-macbook-pro.local>
Sun, 27 Sep 2009 22:18:16 +0000 (17:18 -0500)
basis/math/vectors/simd/functor/functor.factor
basis/math/vectors/simd/simd-docs.factor

index c76ed573d5ef218d29f0e21406ed0dd094f9e4b7..6ed74caa1f744c8429e73634cc66e8b9d3f4161c 100644 (file)
@@ -111,6 +111,7 @@ N            [ 16 T heap-size /i ]
 A            DEFINES-CLASS ${T}-${N}
 A-boa        DEFINES ${A}-boa
 A-with       DEFINES ${A}-with
+A-cast       DEFINES ${A}-cast
 >A           DEFINES >${A}
 A{           DEFINES ${A}{
 
@@ -170,6 +171,9 @@ SYNTAX: A{ \ } [ >A ] parse-literal ;
     \ A-boa \ A-rep \ A define-boa-custom-inlining
 ] when
 
+: A-cast ( simd-array -- simd-array' )
+    underlying>> \ A boa ; inline
+
 INSTANCE: A sequence
 
 <PRIVATE
@@ -228,6 +232,7 @@ A/2-with     IS ${A/2}-with
 A            DEFINES-CLASS ${T}-${N}
 A-boa        DEFINES ${A}-boa
 A-with       DEFINES ${A}-with
+A-cast       DEFINES ${A}-cast
 >A           DEFINES >${A}
 A{           DEFINES ${A}{
 
@@ -295,6 +300,9 @@ M: A pprint* pprint-object ;
 
 \ A-rep 2 boa-effect \ A-boa set-stack-effect
 
+: A-cast ( simd-array -- simd-array' )
+    [ underlying1>> ] [ underlying2>> ] bi \ A boa ; inline
+
 INSTANCE: A sequence
 
 : A-vv->v-op ( v1 v2 quot -- v3 )
index 2fdb9ff88c936c0725e82cd297bd5f9dbf669c8a..6dc0f87dd4b096658d0e7fb76dac2e90f1685843 100644 (file)
@@ -68,6 +68,7 @@ ARTICLE: "math.vectors.simd.words" "SIMD vector words"
     { "Word" "Stack effect" "Description" }
     { { $snippet "type-with" } { $snippet "( x -- simd-array )" } "creates a new instance where all components are set to a single scalar" }
     { { $snippet "type-boa" } { $snippet "( ... -- simd-array )" } "creates a new instance where components are read from the stack" }
+    { { $snipept "type-cast" } { $snippet "( simd-array -- simd-array' )" } "creates a new SIMD array where the underlying data is taken from another SIMD array, with no format conversion" }
     { { $snippet ">type" } { $snippet "( seq -- simd-array )" } "creates a new instance initialized with the elements of an existing sequence, which must have the correct length" }
     { { $snippet "type{" } { $snippet "type{ elements... }" } "parsing word defining literal syntax for an SIMD vector; the correct number of elements must be given" }
 }