NT2_TEST_CASE_TPL ( bitwise_notor_signed_int__2_0, NT2_INTEGRAL_SIGNED_TYPES) { using nt2::bitwise_notor; using nt2::tag::bitwise_notor_; typedef typename nt2::meta::as_integer<T>::type iT; typedef typename nt2::meta::call<bitwise_notor_(T,T)>::type r_t; typedef typename nt2::meta::scalar_of<r_t>::type ssr_t; typedef typename nt2::meta::upgrade<T>::type u_t; typedef T wished_r_t; // return type conformity test NT2_TEST( (boost::is_same < r_t, wished_r_t >::value) ); std::cout << std::endl; double ulpd; ulpd=0.0; // specific values tests NT2_TEST_EQUAL(bitwise_notor(nt2::Mone<T>(),nt2::Zero<T>()), nt2::Zero<r_t>()); NT2_TEST_EQUAL(bitwise_notor(nt2::One<T>(), nt2::One<T>()), nt2::Mone<r_t>()); NT2_TEST_EQUAL(bitwise_notor(nt2::Zero<T>(), nt2::Zero<T>()), nt2::Mone<r_t>()); NT2_TEST_EQUAL(bitwise_notor(nt2::Zero<T>(),nt2::One<T>()), r_t(nt2::Mone<r_t>())); } // end of test for signed_int_
NT2_TEST_CASE_TPL ( bitwise_notor_unsigned_int__2_0, NT2_SIMD_UNSIGNED_TYPES) { using nt2::bitwise_notor; using nt2::tag::bitwise_notor_; using nt2::load; using boost::simd::native; using nt2::meta::cardinal_of; typedef NT2_SIMD_DEFAULT_EXTENSION ext_t; typedef typename nt2::meta::upgrade<T>::type u_t; typedef native<T,ext_t> n_t; typedef n_t vT; typedef typename nt2::meta::as_integer<T>::type iT; typedef native<iT,ext_t> ivT; typedef typename nt2::meta::call<bitwise_notor_(vT,vT)>::type r_t; typedef typename nt2::meta::call<bitwise_notor_(T,T)>::type sr_t; typedef typename nt2::meta::scalar_of<r_t>::type ssr_t; double ulpd; ulpd=0.0; // specific values tests NT2_TEST_EQUAL(bitwise_notor(nt2::One<vT>(), nt2::One<vT>())[0], nt2::Mone<sr_t>()); NT2_TEST_EQUAL(bitwise_notor(nt2::Zero<vT>(), nt2::Zero<vT>())[0], nt2::Mone<sr_t>()); NT2_TEST_EQUAL(bitwise_notor(nt2::Zero<vT>(),nt2::One<vT>())[0], sr_t(nt2::Mone<sr_t>())); } // end of test for unsigned_int_
NT2_TEST_CASE_TPL ( bitwise_notor_integer__2, NT2_INTEGRAL_TYPES) { using nt2::bitwise_notor; using nt2::tag::bitwise_notor_; typedef typename nt2::meta::as_integer<T>::type iT; typedef typename nt2::meta::call<bitwise_notor_(T,T)>::type r_t; typedef typename nt2::meta::upgrade<T>::type u_t; typedef T wished_r_t; // return type conformity test NT2_TEST( (boost::is_same < r_t, wished_r_t >::value) ); std::cout << std::endl; double ulpd; ulpd=0.0; // specific values tests NT2_TEST_EQUAL(bitwise_notor(nt2::One<T>(), nt2::One<T>()), nt2::Mone<r_t>()); NT2_TEST_EQUAL(bitwise_notor(nt2::One<T>(),nt2::Zero<T>()), r_t(~nt2::One<r_t>())); NT2_TEST_EQUAL(bitwise_notor(nt2::Zero<T>(), nt2::Zero<T>()), nt2::Mone<r_t>()); // random verifications static const uint32_t NR = NT2_NB_RANDOM_TEST; { NT2_CREATE_BUF(tab_a0,T, NR, T(-10000), T(10000)); NT2_CREATE_BUF(tab_a1,T, NR, T(-10000), T(10000)); double ulp0, ulpd ; ulpd=ulp0=0.0; T a0; T a1; for (uint32_t j =0; j < NR; ++j ) { std::cout << "for params " << " a0 = "<< u_t(a0 = tab_a0[j]) << ", a1 = "<< u_t(a1 = tab_a1[j]) << std::endl; NT2_TEST_EQUAL( nt2::bitwise_notor(a0,a1),r_t((~a0)|a1)); } } } // end of test for integer_
NT2_TEST_CASE_TPL ( bitwise_notor_real__2_0, NT2_REAL_TYPES) { using nt2::bitwise_notor; using nt2::tag::bitwise_notor_; typedef typename nt2::meta::as_integer<T>::type iT; typedef typename nt2::meta::call<bitwise_notor_(T,T)>::type r_t; typedef typename nt2::meta::upgrade<T>::type u_t; typedef T wished_r_t; // return type conformity test NT2_TEST( (boost::is_same < r_t, wished_r_t >::value) ); std::cout << std::endl; double ulpd; ulpd=0.0; // specific values tests NT2_TEST_EQUAL(bitwise_notor(nt2::Inf<T>(), nt2::Inf<T>()), nt2::Nan<r_t>()); NT2_TEST_EQUAL(bitwise_notor(nt2::Minf<T>(), nt2::Minf<T>()), nt2::Nan<r_t>()); NT2_TEST_EQUAL(bitwise_notor(nt2::Nan<T>(), nt2::Nan<T>()), nt2::Nan<r_t>()); NT2_TEST_EQUAL(bitwise_notor(nt2::Zero<T>(), nt2::Zero<T>()), nt2::Nan<r_t>()); } // end of test for real_
NT2_TEST_CASE_TPL ( bitwise_notor_signed_int__2_0, NT2_SIMD_INTEGRAL_SIGNED_TYPES) { using nt2::bitwise_notor; using nt2::tag::bitwise_notor_; using nt2::load; using boost::simd::native; using nt2::meta::cardinal_of; typedef NT2_SIMD_DEFAULT_EXTENSION ext_t; typedef typename nt2::meta::upgrade<T>::type u_t; typedef native<T,ext_t> n_t; typedef n_t vT; typedef typename nt2::meta::as_integer<T>::type iT; typedef native<iT,ext_t> ivT; typedef typename nt2::meta::call<bitwise_notor_(vT,vT)>::type r_t; typedef typename nt2::meta::call<bitwise_notor_(T,T)>::type sr_t; typedef typename nt2::meta::scalar_of<r_t>::type ssr_t; double ulpd; ulpd=0.0; // random verifications static const nt2::uint32_t NR = NT2_NB_RANDOM_TEST; { NT2_CREATE_BUF(tab_a0,T, NR, nt2::Valmin<T>()/2, nt2::Valmax<T>()/2); NT2_CREATE_BUF(tab_a1,T, NR, nt2::Valmin<T>()/2, nt2::Valmax<T>()/2); double ulp0, ulpd ; ulpd=ulp0=0.0; for(nt2::uint32_t j = 0; j < NR;j+=cardinal_of<n_t>::value) { vT a0 = load<vT>(&tab_a0[0],j); vT a1 = load<vT>(&tab_a1[0],j); r_t v = bitwise_notor(a0,a1); for(nt2::uint32_t i = 0; i< cardinal_of<n_t>::value; i++) { NT2_TEST_EQUAL( v[i],ssr_t(nt2::bitwise_notor (a0[i],a1[i]))); } } } } // end of test for signed_int_
NT2_TEST_CASE_TPL ( bitwise_notor_real_convert__2, NT2_REAL_CONVERTIBLE_TYPES) { using nt2::bitwise_notor; using nt2::tag::bitwise_notor_; using nt2::load; using nt2::simd::native; using nt2::meta::cardinal_of; typedef NT2_SIMD_DEFAULT_EXTENSION ext_t; typedef typename nt2::meta::upgrade<T>::type u_t; typedef native<T,ext_t> n_t; typedef n_t vT; typedef typename nt2::meta::as_integer<T>::type iT; typedef native<iT,ext_t> ivT; typedef typename nt2::meta::call<bitwise_notor_(vT,vT)>::type r_t; typedef typename nt2::meta::call<bitwise_notor_(T,T)>::type sr_t; typedef typename nt2::meta::scalar_of<r_t>::type ssr_t; // random verifications static const uint32_t NR = NT2_NB_RANDOM_TEST; { NT2_CREATE_BUF(tab_a0,T, NR, T(-10000), T(10000)); NT2_CREATE_BUF(tab_a1,T, NR, T(-10000), T(10000)); double ulp0, ulpd ; ulpd=ulp0=0.0; for(uint32_t j = 0; j < NR/cardinal_of<n_t>::value; j++) { vT a0 = load<vT>(&tab_a0[0],j); vT a1 = load<vT>(&tab_a1[0],j); r_t v = bitwise_notor(a0,a1); for(int i = 0; i< cardinal_of<n_t>::value; i++) { int k = i+j*cardinal_of<n_t>::value; NT2_TEST_EQUAL( v[i],ssr_t(nt2::bitwise_notor(tab_a0[k],tab_a1[k]))); } } } } // end of test for real_convert_