diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-06-01 14:35:12 -0400 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-06-01 14:35:12 -0400 |
commit | c1e107210a413f4c46889b55a71a0478e3cc78ba (patch) | |
tree | 62a30a9d2b82044a1c9192a87dcf664744e35741 /vec_double_sse2_scalar.h | |
parent | 9bad5e405719fdd84f052a3de54b3572ebbb46e8 (diff) | |
download | vecmathlib-c1e107210a413f4c46889b55a71a0478e3cc78ba.zip vecmathlib-c1e107210a413f4c46889b55a71a0478e3cc78ba.tar.gz |
If necessary, use built-in methods to convert scalar int to scalar float
Diffstat (limited to 'vec_double_sse2_scalar.h')
-rw-r--r-- | vec_double_sse2_scalar.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/vec_double_sse2_scalar.h b/vec_double_sse2_scalar.h index e9f6312..948f242 100644 --- a/vec_double_sse2_scalar.h +++ b/vec_double_sse2_scalar.h @@ -339,7 +339,13 @@ namespace vecmathlib { intvec_t as_int() const { return floatprops::as_int(v); } - intvec_t convert_int() const { return floatprops::convert_int(v); } + intvec_t convert_int() const { +#ifdef __x86_64__ + return _mm_cvttsd_si64(_mm_set_sd(v)); +#else + return floatprops::convert_int(v); +#endif + } @@ -506,7 +512,11 @@ namespace vecmathlib { inline auto intvec<double,1>::convert_float() const -> realvec_t { +#ifdef __x86_64__ return _mm_cvtsd_f64(_mm_cvtsi64_sd(_mm_setzero_pd(), v)); +#else + return FP::convert_float(v); +#endif } } // namespace vecmathlib |