From fa01ae5980f0ed43851304464102b4e6cab1e7eb Mon Sep 17 00:00:00 2001 From: paboyle Date: Sat, 28 Nov 2015 17:00:34 -0800 Subject: [PATCH] integer divide --- lib/simd/Grid_vector_unops.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/simd/Grid_vector_unops.h b/lib/simd/Grid_vector_unops.h index e4942937..540a54f5 100644 --- a/lib/simd/Grid_vector_unops.h +++ b/lib/simd/Grid_vector_unops.h @@ -67,6 +67,14 @@ namespace Grid { } }; + template struct DivIntFunctor { + Integer y; + DivIntFunctor(Integer _y) : y(_y) {}; + scalar operator()(const scalar &a) const { + return Integer(a)/y; + } + }; + template struct RealFunctor { scalar operator()(const scalar &a) const { return real(a); @@ -131,6 +139,10 @@ namespace Grid { inline Grid_simd mod(const Grid_simd &r,Integer y) { return SimdApply(ModIntFunctor(y),r); } + template < class S, class V > + inline Grid_simd div(const Grid_simd &r,Integer y) { + return SimdApply(DivIntFunctor(y),r); + } //////////////////////////////////////////////////////////////////////////// // Allows us to assign into **conformable** real vectors from complex ////////////////////////////////////////////////////////////////////////////