diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-03-22 23:22:21 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-03-22 23:22:21 -0400 |
commit | 49ba80115cfd2a242c2f0ee5e4c86c97e0a12acb (patch) | |
tree | 57b63bd1d3fb64182b33d022e1d992010c518f93 | |
parent | f1e3688bb3b455fe29c7e3cbe52bff3d47d51c2b (diff) | |
download | vecmathlib-49ba80115cfd2a242c2f0ee5e4c86c97e0a12acb.zip vecmathlib-49ba80115cfd2a242c2f0ee5e4c86c97e0a12acb.tar.gz |
Do not use "using namespace std" any more
-rw-r--r-- | instantiations.cc | 2 | ||||
-rw-r--r-- | mathfuncs_fabs.h | 2 | ||||
-rw-r--r-- | test.cc | 34 | ||||
-rw-r--r-- | vec_builtin.h | 2 | ||||
-rw-r--r-- | vec_mask.h | 1 | ||||
-rw-r--r-- | vec_pseudo.h | 6 |
6 files changed, 23 insertions, 24 deletions
diff --git a/instantiations.cc b/instantiations.cc index cc0c048..14854f6 100644 --- a/instantiations.cc +++ b/instantiations.cc @@ -5,7 +5,7 @@ #include "vecmathlib.h" -using namespace std; + namespace vecmathlib { diff --git a/mathfuncs_fabs.h b/mathfuncs_fabs.h index 675ef5d..4a3bc54 100644 --- a/mathfuncs_fabs.h +++ b/mathfuncs_fabs.h @@ -55,7 +55,7 @@ namespace vecmathlib { { intvec_t e = lsr(as_int(x) & IV(FP::exponent_mask), FP::mantissa_bits); intvec_t r = e - IV(FP::exponent_offset); - r = ifthen(convert_bool(e), r, IV(numeric_limits<int_t>::min())); + r = ifthen(convert_bool(e), r, IV(std::numeric_limits<int_t>::min())); return r; } @@ -383,23 +383,23 @@ struct vecmathlib_test { } // Change signature: "int" -> "int_t" - static int_t ilogb(real_t x) + static int_t local_ilogb(real_t x) { - int r = std::ilogb(x); - if (r==FP_ILOGB0) return numeric_limits<int_t>::min(); - if (r==FP_ILOGBNAN) return numeric_limits<int_t>::max(); + int r = ilogb(x); + if (r==FP_ILOGB0) return std::numeric_limits<int_t>::min(); + if (r==FP_ILOGBNAN) return std::numeric_limits<int_t>::max(); return r; } - static real_t ldexp(real_t x, int_t n) { return std::ldexp(x, n); } + static real_t local_ldexp(real_t x, int_t n) { return ldexp(x, n); } static void test_fabs() { cout << " testing copysign fabs fdim fma fmax fmin ilogb isfinite isinf isnan isnormal ldexp signbit...\n" << flush; const real_t eps = FP::epsilon(); - const real_t int_min = R(numeric_limits<int_t>::min()); - const real_t int_max = R(numeric_limits<int_t>::max()); - const real_t uint_min = R(numeric_limits<uint_t>::min()); - const real_t uint_max = R(numeric_limits<uint_t>::max()); + const real_t int_min = R(std::numeric_limits<int_t>::min()); + const real_t int_max = R(std::numeric_limits<int_t>::max()); + const real_t uint_min = R(std::numeric_limits<uint_t>::min()); + const real_t uint_max = R(std::numeric_limits<uint_t>::max()); const real_t values[] = { R(+0.0), R(+0.1), R(+0.9), R(+1.0), R(+1.1), R(-0.0), R(-0.1), R(-0.9), R(-1.0), R(-1.1), @@ -450,7 +450,7 @@ struct vecmathlib_test { check("fma", fma, vecmathlib::fma, x, y, z, R(2.0)*accuracy()); check("fmax", fmax, vecmathlib::fmax, x, y, 0.0); check("fmin", fmin, vecmathlib::fmin, x, y, 0.0); - check("ilogb", ilogb, vecmathlib::ilogb, x); + check("ilogb", local_ilogb, vecmathlib::ilogb, x); #if defined VML_HAVE_INF && defined VML_HAVE_NAN check("isfinite", isfinite, vecmathlib::isfinite, x); #endif @@ -463,7 +463,7 @@ struct vecmathlib_test { #ifdef VML_HAVE_DENORMALS check("isnormal", isnormal, vecmathlib::isnormal, x); #endif - check("ldexp", ldexp, vecmathlib::ldexp, x, n, 0.0); + check("ldexp", local_ldexp, vecmathlib::ldexp, x, n, 0.0); check("signbit", signbit, vecmathlib::signbit, x); } } @@ -474,10 +474,10 @@ struct vecmathlib_test { << flush; const real_t eps = FP::epsilon(); - const real_t int_min = R(numeric_limits<int_t>::min()); - const real_t int_max = R(numeric_limits<int_t>::max()); - const real_t uint_min = R(numeric_limits<uint_t>::min()); - const real_t uint_max = R(numeric_limits<uint_t>::max()); + const real_t int_min = R(std::numeric_limits<int_t>::min()); + const real_t int_max = R(std::numeric_limits<int_t>::max()); + const real_t uint_min = R(std::numeric_limits<uint_t>::min()); + const real_t uint_max = R(std::numeric_limits<uint_t>::max()); const real_t values[] = { R(+0.0), R(+0.1), R(+0.9), R(+1.0), R(+1.1), R(-0.0), R(-0.1), R(-0.9), R(-1.0), R(-1.1), @@ -520,8 +520,8 @@ struct vecmathlib_test { intvec_t const n1 = random(int_t(-100), int_t(+100)); //intvec_t const n2 = random(int_t(-1000000000), int_t(+1000000000)); intvec_t const n2 = - random(numeric_limits<int_t>::min() / 2, // avoid overflow - numeric_limits<int_t>::max() / 2); + random(std::numeric_limits<int_t>::min() / 2, // avoid overflow + std::numeric_limits<int_t>::max() / 2); realvec_t const fn1 = vecmathlib::convert_float(n1); realvec_t const fn2 = vecmathlib::convert_float(n2); realvec_t const fn1h = vecmathlib::convert_float(n1) * RV(0.25); diff --git a/vec_builtin.h b/vec_builtin.h index 519aa86..8063de8 100644 --- a/vec_builtin.h +++ b/vec_builtin.h @@ -312,7 +312,7 @@ namespace vecmathlib { { static std::string name_; if (name_.empty()) { - stringstream buf; + std::stringstream buf; buf << "<builtin:" << N << "*" << FP::name() << ">"; name_ = buf.str(); } @@ -8,7 +8,6 @@ namespace vecmathlib { - using namespace std; template<typename realvec_t> class mask_t { diff --git a/vec_pseudo.h b/vec_pseudo.h index ad3a70c..c39fa5c 100644 --- a/vec_pseudo.h +++ b/vec_pseudo.h @@ -379,7 +379,7 @@ namespace vecmathlib { { static std::string name_; if (name_.empty()) { - stringstream buf; + std::stringstream buf; buf << "<libm:" << N << "*" << FP::name() << ">"; name_ = buf.str(); } @@ -682,8 +682,8 @@ namespace vecmathlib { intvec_t res; for (int d=0; d<size; ++d) { int_t r = std::ilogb(v[d]); - if (r == FP_ILOGB0) r = numeric_limits<int_t>::min(); - else if (r == FP_ILOGBNAN) r = numeric_limits<int_t>::max(); + if (r == FP_ILOGB0) r = std::numeric_limits<int_t>::min(); + else if (r == FP_ILOGBNAN) r = std::numeric_limits<int_t>::max(); res.v[d] = r; } return res; |