break vector conversion intrinsics off to a math.vectors.conversion.backend vocab so the whole conversion vocab doesn't get sucked in by the compiler
parent
879fe9a665
commit
4d4da7ac23
|
@ -0,0 +1,21 @@
|
|||
! (c)Joe Groff bsd license
|
||||
USING: accessors alien.c-types arrays assocs classes combinators
|
||||
cords fry kernel math math.vectors sequences ;
|
||||
IN: math.vectors.conversion.backend
|
||||
|
||||
: saturate-map-as ( v quot result -- w )
|
||||
[ element-type '[ @ _ c-type-clamp ] ] keep map-as ; inline
|
||||
|
||||
: (v>float) ( i to-type -- f )
|
||||
[ >float ] swap new map-as ;
|
||||
: (v>integer) ( f to-type -- i )
|
||||
[ >integer ] swap new map-as ;
|
||||
: (vpack-signed) ( a b to-type -- ab )
|
||||
[ cord-append [ ] ] dip new saturate-map-as ;
|
||||
: (vpack-unsigned) ( a b to-type -- ab )
|
||||
[ cord-append [ ] ] dip new saturate-map-as ;
|
||||
: (vunpack-head) ( ab to-type -- a )
|
||||
[ dup length 2 /i head-slice ] dip new like ;
|
||||
: (vunpack-tail) ( ab to-type -- b )
|
||||
[ dup length 2 /i tail-slice ] dip new like ;
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
! (c)Joe Groff bsd license
|
||||
USING: accessors alien.c-types arrays assocs classes combinators
|
||||
combinators.short-circuit cords fry kernel locals math
|
||||
math.vectors sequences ;
|
||||
math.vectors math.vectors.conversion.backend sequences ;
|
||||
FROM: alien.c-types => char uchar short ushort int uint longlong ulonglong float double ;
|
||||
IN: math.vectors.conversion
|
||||
|
||||
|
@ -10,22 +10,6 @@ ERROR: bad-vconvert-input value expected-type ;
|
|||
|
||||
<PRIVATE
|
||||
|
||||
: saturate-map-as ( v quot result -- w )
|
||||
[ element-type '[ @ _ c-type-clamp ] ] keep map-as ; inline
|
||||
|
||||
: (v>float) ( i to-type -- f )
|
||||
[ >float ] swap new map-as ;
|
||||
: (v>integer) ( f to-type -- i )
|
||||
[ >integer ] swap new map-as ;
|
||||
: (vpack-signed) ( a b to-type -- ab )
|
||||
[ cord-append [ ] ] dip new saturate-map-as ;
|
||||
: (vpack-unsigned) ( a b to-type -- ab )
|
||||
[ cord-append [ ] ] dip new saturate-map-as ;
|
||||
: (vunpack-head) ( ab to-type -- a )
|
||||
[ dup length 2 /i head-slice ] dip new like ;
|
||||
: (vunpack-tail) ( ab to-type -- b )
|
||||
[ dup length 2 /i tail-slice ] dip new like ;
|
||||
|
||||
: float-type? ( c-type -- ? )
|
||||
{ float double } memq? ;
|
||||
: unsigned-type? ( c-type -- ? )
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: accessors assocs byte-arrays classes classes.algebra effects fry
|
||||
functors generalizations kernel literals locals math math.functions
|
||||
math.vectors math.vectors.private math.vectors.simd.intrinsics
|
||||
math.vectors.conversion math.vectors.conversion.private
|
||||
math.vectors.conversion.backend
|
||||
math.vectors.specialization parser prettyprint.custom sequences
|
||||
sequences.private strings words definitions macros cpu.architecture
|
||||
namespaces arrays quotations combinators combinators.short-circuit sets
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
USING: alien alien.c-types alien.data assocs combinators
|
||||
cpu.architecture compiler.cfg.comparisons fry generalizations
|
||||
kernel libc macros math
|
||||
math.vectors.conversion math.vectors.conversion.private
|
||||
math.vectors.conversion.backend
|
||||
sequences effects accessors namespaces
|
||||
lexer parser vocabs.parser words arrays math.vectors ;
|
||||
IN: math.vectors.simd.intrinsics
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: words kernel make sequences effects sets kernel.private
|
||||
accessors combinators math math.intervals math.vectors
|
||||
math.vectors.conversion math.vectors.conversion.private
|
||||
math.vectors.conversion.backend
|
||||
namespaces assocs fry splitting classes.algebra generalizations
|
||||
locals compiler.tree.propagation.info ;
|
||||
IN: math.vectors.specialization
|
||||
|
|
Loading…
Reference in New Issue