Code indexing in gitaly is broken and leads to code not being visible to the user. We work on the issue with highest priority.

Skip to content
Snippets Groups Projects
Commit 4729515b authored by gsell's avatar gsell
Browse files

cleanup: IPPL_USE_FUNKY_VEC_COPIES related code removed

parent 93d7d53f
No related branches found
No related tags found
1 merge request!244Resolve "cleanup: remove IPPL_USE_FUNKY_VEC_COPIES"
......@@ -25,10 +25,6 @@ public:
vec(T v0);
vec(T v0, T v1);
vec(T v0, T v1, T v2);
#ifdef IPPL_USE_FUNKY_VEC_COPIES
vec( const vec<T,Length>& );
vec<T,Length>& operator=( const vec<T,Length>& );
#endif
T& operator[](unsigned d) { return Ptr[d]; }
const T& operator[](unsigned d) const { return Ptr[d]; }
Message& putMessage(Message &m) {
......@@ -55,99 +51,6 @@ private:
//////////////////////////////////////////////////////////////////////
#ifdef IPPL_USE_FUNKY_VEC_COPIES
//
// Implementation of copy constructor and op=.
//
// These use a template trick to unroll the loop over elements of the vec.
//
//
// A tag class to let us unroll this loop.
// It isn't entirely clear this needs to be done, but
// it is an interesting demonstration.
//
// It is just a record of how many elements to copy,
// along with a flag. The flag has the values:
// 4: If Length>=4. That means the interval should be split in half.
// 0..3: Call an explicit function for this length.
//
template<unsigned Length, int Flag>
class DivideVecCopyTag {
};
//
// Copy a vector of length 4 or greater.
// Split it in half and copy each half.
// Do it this way so that the depth of inlining is O(log(Length))
// instead of O(Length).
//
template<class T1, class T2, unsigned L>
inline void
divide_vec_copy(T1 *p1, T2 *p2, DivideVecCopyTag<L,4> )
{
divide_vec_copy(p1, p2, DivideVecCopyTag< L/2 , (L>=8 ? 4 : L/2)>());
divide_vec_copy(p1+(L/2), p2+(L/2),DivideVecCopyTag<L-L/2,(L>=8?4:L-L/2)>());
}
//
// Copy a vector of length 0, 1, 2 or 3. Just move it.
//
template<class T1, class T2>
inline void
divide_vec_copy(T1 *p1, T2 *p2, DivideVecCopyTag<3,3> )
{
p1[0] = p2[0];
p1[1] = p2[1];
p1[2] = p2[2];
}
template<class T1, class T2>
inline void
divide_vec_copy(T1 *p1, T2 *p2, DivideVecCopyTag<2,2> )
{
p1[0] = p2[0];
p1[1] = p2[1];
}
template<class T1, class T2>
inline void
divide_vec_copy(T1 *p1, T2 *p2, DivideVecCopyTag<1,1> )
{
*p1 = *p2;
}
template<class T1, class T2>
inline void
divide_vec_copy(T1 *,T2 *, DivideVecCopyTag<0,0> )
{
}
//
// The copy ctor and op= just call divide_vec_copy to do the copy
//
template<class T, unsigned L>
inline
vec<T,L>::vec( const vec<T,L>& v )
{
divide_vec_copy( Ptr , v.Ptr , DivideVecCopyTag<L,( L>=4 ? 4 : L)>() );
}
template<class T, unsigned L>
inline vec<T,L>&
vec<T,L>::operator=( const vec<T,L>& v )
{
if ( this != &v )
divide_vec_copy( Ptr , v.Ptr , DivideVecCopyTag<L,( L>=4 ? 4 : L)>() );
return *this;
}
#endif // IPPL_USE_FUNKY_VEC_COPIES
//////////////////////////////////////////////////////////////////////
template<class T, unsigned Length>
inline
vec<T,Length>::vec(T v0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment