1
0
mirror of https://github.com/paboyle/Grid.git synced 2024-09-20 01:05:38 +01:00

integer divide

This commit is contained in:
paboyle 2015-11-28 17:00:34 -08:00
parent 113131b01c
commit fa01ae5980

View File

@ -67,6 +67,14 @@ namespace Grid {
}
};
template<class scalar> struct DivIntFunctor {
Integer y;
DivIntFunctor(Integer _y) : y(_y) {};
scalar operator()(const scalar &a) const {
return Integer(a)/y;
}
};
template<class scalar> struct RealFunctor {
scalar operator()(const scalar &a) const {
return real(a);
@ -131,6 +139,10 @@ namespace Grid {
inline Grid_simd<S,V> mod(const Grid_simd<S,V> &r,Integer y) {
return SimdApply(ModIntFunctor<S>(y),r);
}
template < class S, class V >
inline Grid_simd<S,V> div(const Grid_simd<S,V> &r,Integer y) {
return SimdApply(DivIntFunctor<S>(y),r);
}
////////////////////////////////////////////////////////////////////////////
// Allows us to assign into **conformable** real vectors from complex
////////////////////////////////////////////////////////////////////////////