28 typedef typename V1::EntryType
T1;
29 typedef typename V2::EntryType
T2;
33 const T1 n1 =
static_cast<T1
>(
n);
35 COMPARE(static_cast<V2>(V1(n1)), V2(static_cast<T2>(n1))) <<
"\n n1: " << n1;
45 const int intDigits = std::numeric_limits<int>::digits;
46 const int floatDigits = std::numeric_limits<float>::digits;
47 return static_cast<double>(((int(1) << floatDigits) - 1) << (intDigits - floatDigits));
52 const int intDigits = std::numeric_limits<unsigned int>::digits;
53 const int floatDigits = std::numeric_limits<float>::digits;
54 return static_cast<double>(((unsigned(1) << floatDigits) - 1) << (intDigits - floatDigits));
59 typedef typename V1::EntryType
T1;
60 typedef typename V2::EntryType
T2;
62 const double max =
std::min(maxHelper<T1>(), maxHelper<T2>());
64 std::numeric_limits<T1>::is_integer ?
67 std::numeric_limits<T2>::is_integer ?
72 testNumber<V1, V2>(0.);
73 testNumber<V1, V2>(1.);
74 testNumber<V1, V2>(2.);
75 testNumber<V1, V2>(
max);
76 testNumber<V1, V2>(max / 4 + max / 2);
77 testNumber<V1, V2>(max / 2);
78 testNumber<V1, V2>(max / 4);
79 testNumber<V1, V2>(
min);
84 testCast2<typename T::V1, typename T::V2>();
87 #define _CONCAT(A, B) A ## _ ## B
88 #define CONCAT(A, B) _CONCAT(A, B)
89 template<
typename T1,
typename T2>
104 int main(
int argc,
char **argv)
108 #define TEST(v1, v2) \
109 typedef T2Helper<v1, v2> CONCAT(v1, v2); \
110 runTest(testCast<CONCAT(v1, v2)>)
void testNumber(double n)
void testFloatIndexesFromZero()
VECTOR_NAMESPACE::uint_v uint_v
VECTOR_NAMESPACE::sfloat_v sfloat_v
static Vc_ALWAYS_INLINE int_v min(const int_v &x, const int_v &y)
void initTest(int argc, char **argv)
VECTOR_NAMESPACE::short_v short_v
double maxHelper< int >()
VECTOR_NAMESPACE::ushort_v ushort_v
int main(int argc, char **argv)
double maxHelper< unsigned int >()
VECTOR_NAMESPACE::int_v int_v
VECTOR_NAMESPACE::float_v float_v
static Vc_ALWAYS_INLINE int_v max(const int_v &x, const int_v &y)