diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-09-02 18:46:35 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-09-02 18:46:35 -0500 |
commit | 6c0dda77c6983fe4c2cda9215c028c1b92098b0a (patch) | |
tree | 71db6d78b5f9ebc18ef06844f0d4900ad493bb5f /vec_pseudo.h | |
parent | 10e1b0a0dd9e4f1ec21d48786afa6c3165389fed (diff) | |
download | vecmathlib-6c0dda77c6983fe4c2cda9215c028c1b92098b0a.zip vecmathlib-6c0dda77c6983fe4c2cda9215c028c1b92098b0a.tar.gz |
Protect __builtin_clz and __builtin_popcount with #ifdefs
Diffstat (limited to 'vec_pseudo.h')
-rw-r--r-- | vec_pseudo.h | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/vec_pseudo.h b/vec_pseudo.h index 3b940fc..e2ba9f0 100644 --- a/vec_pseudo.h +++ b/vec_pseudo.h @@ -363,6 +363,7 @@ namespace vecmathlib { intvec_t clz() const { intvec_t res; +#if defined __clang__ || defined __gcc__ if (sizeof(int_t) == sizeof(long long)) { for (int d=0; d<size; ++d) res.v[d] = __builtin_clzll(v[d]); } else if (sizeof(int_t) == sizeof(long)) { @@ -374,11 +375,15 @@ namespace vecmathlib { } else { __builtin_unreachable(); } +#else + res = MF::vml_clz(*this); +#endif return res; } intvec_t popcount() const { intvec_t res; +#if defined __clang__ || defined __gcc__ if (sizeof(int_t) == sizeof(long long)) { for (int d=0; d<size; ++d) res.v[d] = __builtin_popcountll(v[d]); } else if (sizeof(int_t) == sizeof(long)) { @@ -388,6 +393,9 @@ namespace vecmathlib { } else { __builtin_unreachable(); } +#else + res = MF::vml_popcount(*this); +#endif return res; } |