diff --git a/basis/math/vectors/simd/functor/functor.factor b/basis/math/vectors/simd/functor/functor.factor index cabb731fef..641585a5d7 100644 --- a/basis/math/vectors/simd/functor/functor.factor +++ b/basis/math/vectors/simd/functor/functor.factor @@ -9,14 +9,16 @@ ERROR: bad-length got expected ; FUNCTOR: define-simd-128 ( T -- ) -N [ 16 T heap-size /i ] +T-TYPE IS ${T} + +N [ 16 T-TYPE heap-size /i ] A DEFINES-CLASS ${T}-${N} >A DEFINES >${A} A{ DEFINES ${A}{ -NTH [ T dup c-type-getter-boxer array-accessor ] -SET-NTH [ T dup c-setter array-accessor ] +NTH [ T-TYPE dup c-type-getter-boxer array-accessor ] +SET-NTH [ T-TYPE dup c-setter array-accessor ] A-rep IS ${A}-rep A-vv->v-op DEFINES-PRIVATE ${A}-vv->v-op @@ -74,7 +76,9 @@ PRIVATE> ! Synthesize 256-bit vectors from a pair of 128-bit vectors FUNCTOR: define-simd-256 ( T -- ) -N [ 32 T heap-size /i ] +T-TYPE IS ${T} + +N [ 32 T-TYPE heap-size /i ] N/2 [ N 2 / ] A/2 IS ${T}-${N/2} diff --git a/basis/math/vectors/simd/simd.factor b/basis/math/vectors/simd/simd.factor index 7df9b2d8d2..a3c99ae217 100644 --- a/basis/math/vectors/simd/simd.factor +++ b/basis/math/vectors/simd/simd.factor @@ -5,6 +5,8 @@ kernel math math.functions math.vectors math.vectors.simd.functor math.vectors.simd.intrinsics math.vectors.specialization parser prettyprint.custom sequences sequences.private locals assocs words fry ; +FROM: alien.c-types => float ; +QUALIFIED-WITH: math m IN: math.vectors.simd << @@ -15,9 +17,9 @@ DEFER: float-8 DEFER: double-4 "double" define-simd-128 -"float" define-simd-128 +"float" define-simd-128 "double" define-simd-256 -"float" define-simd-256 +"float" define-simd-256 >> @@ -136,7 +138,7 @@ DEFER: double-4 PRIVATE> -\ float-4 \ float-4-with float H{ +\ float-4 \ float-4-with m:float H{ { v+ [ [ (simd-v+) ] float-4-vv->v-op ] } { v- [ [ (simd-v-) ] float-4-vv->v-op ] } { v* [ [ (simd-v*) ] float-4-vv->v-op ] } @@ -146,7 +148,7 @@ PRIVATE> { sum [ [ (simd-sum) ] float-4-v->n-op ] } } simd-vector-words -\ double-2 \ double-2-with float H{ +\ double-2 \ double-2-with m:float H{ { v+ [ [ (simd-v+) ] double-2-vv->v-op ] } { v- [ [ (simd-v-) ] double-2-vv->v-op ] } { v* [ [ (simd-v*) ] double-2-vv->v-op ] } @@ -156,7 +158,7 @@ PRIVATE> { sum [ [ (simd-sum) ] double-2-v->n-op ] } } simd-vector-words -\ float-8 \ float-8-with float H{ +\ float-8 \ float-8-with m:float H{ { v+ [ [ (simd-v+) ] float-8-vv->v-op ] } { v- [ [ (simd-v-) ] float-8-vv->v-op ] } { v* [ [ (simd-v*) ] float-8-vv->v-op ] } @@ -166,7 +168,7 @@ PRIVATE> { sum [ [ (simd-sum) ] [ + ] float-8-v->n-op ] } } simd-vector-words -\ double-4 \ double-4-with float H{ +\ double-4 \ double-4-with m:float H{ { v+ [ [ (simd-v+) ] double-4-vv->v-op ] } { v- [ [ (simd-v-) ] double-4-vv->v-op ] } { v* [ [ (simd-v*) ] double-4-vv->v-op ] } diff --git a/basis/specialized-arrays/specialized-arrays-tests.factor b/basis/specialized-arrays/specialized-arrays-tests.factor index 2698149bac..e289efb077 100755 --- a/basis/specialized-arrays/specialized-arrays-tests.factor +++ b/basis/specialized-arrays/specialized-arrays-tests.factor @@ -5,6 +5,7 @@ kernel arrays combinators compiler compiler.units classes.struct combinators.smart compiler.tree.debugger math libc destructors sequences.private multiline eval words vocabs namespaces assocs prettyprint ; +FROM: alien.c-types => float ; SPECIALIZED-ARRAY: int SPECIALIZED-ARRAY: bool diff --git a/basis/x11/xlib/xlib.factor b/basis/x11/xlib/xlib.factor index 48d556de1d..98305e8304 100644 --- a/basis/x11/xlib/xlib.factor +++ b/basis/x11/xlib/xlib.factor @@ -13,6 +13,7 @@ USING: accessors kernel arrays alien alien.c-types alien.strings alien.syntax classes.struct math math.bitwise words sequences namespaces continuations io io.encodings.ascii x11.syntax ; +FROM: alien.c-types => short ; IN: x11.xlib LIBRARY: xlib diff --git a/extra/alien/marshall/marshall.factor b/extra/alien/marshall/marshall.factor index 2cae122641..e8ea0d3754 100644 --- a/extra/alien/marshall/marshall.factor +++ b/extra/alien/marshall/marshall.factor @@ -6,6 +6,7 @@ combinators combinators.short-circuit destructors fry io.encodings.utf8 kernel libc sequences specialized-arrays strings unix.utilities vocabs.parser words libc.private locals generalizations math ; +FROM: alien.c-types => float short ; SPECIALIZED-ARRAY: bool SPECIALIZED-ARRAY: char SPECIALIZED-ARRAY: double diff --git a/extra/bunny/model/model.factor b/extra/bunny/model/model.factor index dd6730b57f..d80f3aa98a 100755 --- a/extra/bunny/model/model.factor +++ b/extra/bunny/model/model.factor @@ -3,8 +3,9 @@ http.client io io.encodings.ascii io.files io.files.temp kernel math math.matrices math.parser math.vectors opengl opengl.capabilities opengl.gl opengl.demo-support sequences splitting vectors words specialized-arrays ; -SPECIALIZED-ARRAY: float -SPECIALIZED-ARRAY: uint +QUALIFIED-WITH: alien.c-types c +SPECIALIZED-ARRAY: c:float +SPECIALIZED-ARRAY: c:uint IN: bunny.model : numbers ( str -- seq ) diff --git a/extra/gpu/textures/textures.factor b/extra/gpu/textures/textures.factor index 8015ff9a9b..2649f7c586 100644 --- a/extra/gpu/textures/textures.factor +++ b/extra/gpu/textures/textures.factor @@ -3,6 +3,7 @@ USING: accessors alien.c-types arrays byte-arrays combinators destructors fry gpu gpu.buffers images kernel locals math opengl opengl.gl opengl.textures sequences specialized-arrays ui.gadgets.worlds variants ; +FROM: alien.c-types => float ; SPECIALIZED-ARRAY: float IN: gpu.textures diff --git a/extra/openal/openal.factor b/extra/openal/openal.factor index 81a6621eff..bccdec1420 100644 --- a/extra/openal/openal.factor +++ b/extra/openal/openal.factor @@ -4,6 +4,7 @@ USING: kernel accessors arrays alien system combinators alien.syntax namespaces alien.c-types sequences vocabs.loader shuffle openal.backend alien.libraries generalizations specialized-arrays ; +FROM: alien.c-types => float short ; SPECIALIZED-ARRAY: uint IN: openal