Type conversion
Cast:
|
|
|
|
|
|
Conversion:
|
per slot conversion to floating point |
|
per slot conversion to integer |
- template<class T_out, class T_in, class A> XSIMD_INLINE batch_bool< T_out, A > batch_bool_cast (batch_bool< T_in, A > const &x) noexcept
Perform a static_cast from
T_intoT_outon.- Parameters:
x – batch_bool of
T_in- Returns:
xcast toT_out
- template<class T_out, class T_in, class A> XSIMD_INLINE batch< T_out, A > batch_cast (batch< T_in, A > const &x) noexcept
Perform a static_cast from
T_intoT_outon.- Parameters:
x – batch of
T_in- Returns:
xcast toT_out
- template<class T_out, class T_in, class A> XSIMD_INLINE batch< T_out, A > bitwise_cast (batch< T_in, A > const &x) noexcept
Perform a reinterpret_cast from
T_intoT_outonx.- Parameters:
x – batch of
T_in- Returns:
xreinterpreted asT_out
- template<class T, class A> XSIMD_INLINE batch< as_float_t< T >, A > to_float (batch< T, A > const &i) noexcept
Perform a conversion from
ito a value of an floating point type of the same size asT.This is equivalent to
batch_cast<as_float_t<T>>(i)- Parameters:
i – batch of integers.
- Returns:
iconverted to a value of an floating point type of the same size asT
- template<class T, class A> XSIMD_INLINE batch< as_integer_t< T >, A > to_int (batch< T, A > const &x) noexcept
Perform a conversion from
xto a value of an integer type of the same size asTThis is equivalent tobatch_cast<as_integer_t<T>>(x)- Parameters:
x – batch.
- Returns:
xconverted to a value of an integer type of the same size asT
- template<class T, class A, typename std::enable_if< std::is_integral< T >::value, int >::type = 3> XSIMD_INLINE batch< T, A > bitwise_cast (batch_bool< T, A > const &self) noexcept
Cast a
batch_boolofTinto abatchof the same type using the following rule: if an element ofselfis true, it maps to -1 in the returned integral batch, otherwise it maps to 0.- Parameters:
self – batch_bool of
T- Returns:
selfcast to abatchofT