Handbook
Glossary
[vconvert] ( from-element to-element from-size to-size from-type to-type -- quot )
Vocabulary
math
.
vectors
.
conversion
.
private
Inputs
from-element
an
object
to-element
an
object
from-size
an
object
to-size
an
object
from-type
an
object
to-type
an
object
Outputs
quot
an
object
Definition
USING:
accessors
combinators
kernel
math.floats.small.c-types
math.vectors.simd
math.vectors.simd.intrinsics
sequences
;
IN:
math.vectors.conversion.private
::
[vconvert]
( from-element to-element from-size to-size from-type to-type -- quot )
{
{
[
from-element to-element
eq?
]
[
[
]
]
}
{
[
to-element
{
half
bfloat
}
member-eq?
]
[
[
to-type
new
clone-like
]
]
}
{
[
from-element to-element
[
float-type?
not
]
both?
]
[
[
underlying>>
to-type
boa
]
]
}
{
[
from-element
float-type?
]
[
from-type
new
simd-rep
to-element
unsigned-type?
[
'[
underlying>>
_
(simd-v>unsigned-integer)
to-type
boa
]
]
[
'[
underlying>>
_
(simd-v>integer)
to-type
boa
]
]
if
]
}
{
[
to-element
float-type?
]
[
from-type
new
simd-rep
'[
underlying>>
_
(simd-v>float)
to-type
boa
]
]
}
}
cond
[
from-type
check-vconvert-type
]
prepose
;