summaryrefslogtreecommitdiffstats
path: root/vec_pseudo.h
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2013-09-02 18:46:35 -0500
committerErik Schnetter <schnetter@gmail.com>2013-09-02 18:46:35 -0500
commit6c0dda77c6983fe4c2cda9215c028c1b92098b0a (patch)
tree71db6d78b5f9ebc18ef06844f0d4900ad493bb5f /vec_pseudo.h
parent10e1b0a0dd9e4f1ec21d48786afa6c3165389fed (diff)
downloadvecmathlib-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.h8
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;
}
OpenPOWER on IntegriCloud