mirror of
https://github.com/paboyle/Grid.git
synced 2024-11-10 07:55:35 +00:00
integer divide
This commit is contained in:
parent
113131b01c
commit
fa01ae5980
@ -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
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user