diff options
author | Erik Schnetter <schnetter@gmail.com> | 2013-11-25 14:52:26 -0500 |
---|---|---|
committer | Erik Schnetter <schnetter@gmail.com> | 2013-11-25 14:52:26 -0500 |
commit | ec33e3b30b4324cad3f5c26186cc2d2620708a0f (patch) | |
tree | c8f74527bcc52e2f219e6f8a953dd86d5597a75d /vec_builtin.h | |
parent | 89edeef77f22823a1f2cebd46699a29df9d43d95 (diff) | |
download | vecmathlib-ec33e3b30b4324cad3f5c26186cc2d2620708a0f.zip vecmathlib-ec33e3b30b4324cad3f5c26186cc2d2620708a0f.tar.gz |
Provide lrint
Diffstat (limited to 'vec_builtin.h')
-rw-r--r-- | vec_builtin.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/vec_builtin.h b/vec_builtin.h index a9a87cb..d8a8a45 100644 --- a/vec_builtin.h +++ b/vec_builtin.h @@ -686,6 +686,15 @@ namespace vecmathlib { realvec_t log10() const { return map(builtin_log10); } realvec_t log1p() const { return map(builtin_log1p); } realvec_t log2() const { return map(builtin_log2); } + intvec_t lrint() const + { + if (sizeof(int_t) <= sizeof(long)) { + return map(builtin_lrint); + } else if (sizeof(int_t) <= sizeof(long long)) { + return map(builtin_llrint); + } + __builtin_unreachable(); + } realvec_t mad(realvec_t y, realvec_t z) const { return MF::vml_mad(*this, y, z); @@ -1298,6 +1307,12 @@ namespace vecmathlib { } template<typename real_t, int size> + inline intbuiltinvec<real_t, size> lrint(realbuiltinvec<real_t, size> x) + { + return x.lrint(); + } + + template<typename real_t, int size> inline realbuiltinvec<real_t, size> mad(realbuiltinvec<real_t, size> x, realbuiltinvec<real_t, size> y, realbuiltinvec<real_t, size> z) |