Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2009-10-16 16:04:14 -05:00
commit 918e6a78e0
4 changed files with 24 additions and 4 deletions

View File

@ -183,6 +183,13 @@ MACRO: if-literals-match ( quots -- )
[ rep %unpack-vector-head-reps member? ]
[ src rep ^^unpack-vector-head ]
}
{
[ rep unsigned-int-vector-rep? ]
[
rep ^^zero-vector :> zero
src zero rep ^^merge-vector-head
]
}
[
rep ^^zero-vector :> zero
zero src rep cc> ^^compare-vector :> sign
@ -203,6 +210,13 @@ MACRO: if-literals-match ( quots -- )
tail rep ^^unpack-vector-head
]
}
{
[ rep unsigned-int-vector-rep? ]
[
rep ^^zero-vector :> zero
src zero rep ^^merge-vector-tail
]
}
[
rep ^^zero-vector :> zero
zero src rep cc> ^^compare-vector :> sign

View File

@ -91,6 +91,12 @@ MACRO:: test-vconvert ( from-type to-type -- )
[ uint-4{ -1 2 3 -40000 } uint-4{ 5 60000 -7 80000 } uint-4 short-8 test-vconvert ]
[ error>> bad-vconvert? ] must-fail-with
[ ushort-8{ 0 1 2 3 128 129 130 131 } ushort-8{ 4 5 6 7 132 133 134 135 } ]
[
uchar-16{ 0 1 2 3 128 129 130 131 4 5 6 7 132 133 134 135 }
uchar-16 ushort-8 test-vconvert
] unit-test
! TODO we should be able to do 256->128 pack
! [ float-4{ -1.25 2.0 3.0 -4.0 } ]
[ double-4{ -1.25 2.0 3.0 -4.0 } double-4 float-4 test-vconvert ]

View File

@ -2,8 +2,8 @@
! See http://factorcode.org/license.txt for BSD license.
USING: assocs hashtables kernel sequences generic words
arrays classes slots slots.private classes.tuple
classes.tuple.private math vectors quotations accessors
combinators byte-arrays specialized-arrays ;
classes.tuple.private math vectors math.vectors quotations
accessors combinators byte-arrays specialized-arrays ;
IN: mirrors
TUPLE: mirror { object read-only } ;
@ -54,6 +54,8 @@ INSTANCE: vector enumerated-sequence
INSTANCE: callable enumerated-sequence
INSTANCE: byte-array enumerated-sequence
INSTANCE: specialized-array enumerated-sequence
INSTANCE: simd-128 enumerated-sequence
INSTANCE: simd-256 enumerated-sequence
GENERIC: make-mirror ( obj -- assoc )
M: hashtable make-mirror ;

View File

@ -5,8 +5,6 @@ lexer locals macros make math math.ranges parser sequences sequences.private ;
FROM: alien.arrays => array-length ;
IN: alien.data.map
ERROR: bad-data-map-input-length byte-length iter-size remainder ;
<PRIVATE
: <displaced-direct-array> ( displacement bytes length type -- direct-array )