• Main Page
  • Related Pages
  • Modules
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

VecOpsMeta.h

Go to the documentation of this file.
00001 // GMTL is (C) Copyright 2001-2010 by Allen Bierbaum
00002 // Distributed under the GNU Lesser General Public License 2.1 with an
00003 // addendum covering inlined code. (See accompanying files LICENSE and
00004 // LICENSE.addendum or http://www.gnu.org/copyleft/lesser.txt)
00005 
00006 #ifndef _GMTL_VEC_OPS_META_H
00007 #define _GMTL_VEC_OPS_META_H
00008 
00009 #include <gmtl/Util/Meta.h>
00010 
00013 namespace gmtl
00014 {
00015 namespace meta
00016 {
00019 
00021 template<int ELT, typename T1, typename T2>
00022 struct DotVecUnrolled
00023 {
00024    static typename T1::DataType func(const T1& v1, const T2& v2)
00025    {  return (v1[ELT]*v2[ELT]) + DotVecUnrolled<ELT-1,T1,T2>::func(v1,v2); }
00026 };
00027 
00029 template<typename T1, typename T2>
00030 struct DotVecUnrolled<0,T1,T2>
00031 {
00032    static typename T1::DataType func(const T1& v1, const T2& v2)
00033    {   return (v1[0]*v2[0]); }
00034 };
00035 
00037 template<int ELT, typename T>
00038 struct LenSqrVecUnrolled
00039 {
00040    static typename T::DataType func(const T& v)
00041    {  return (v[ELT]*v[ELT]) + LenSqrVecUnrolled<ELT-1,T>::func(v); }
00042 };
00043 
00045 template<typename T>
00046 struct LenSqrVecUnrolled<0,T>
00047 {
00048    static typename T::DataType func(const T& v)
00049    {   return (v[0]*v[0]); }
00050 };
00051 
00053 template<int ELT, typename VT>
00054 struct EqualVecUnrolled
00055 {
00056    static bool func(const VT& v1, const VT& v2)
00057    {  return (v1[ELT]==v2[ELT]) && EqualVecUnrolled<ELT-1,VT>::func(v1,v2); }
00058 };
00059 
00061 template<typename VT>
00062 struct EqualVecUnrolled<0,VT>
00063 {
00064    static bool func(const VT& v1, const VT& v2)
00065    {   return (v1[0]==v2[0]); }
00066 };
00068 
00069 } // namespace meta
00070 } // end namespace
00071 
00072 
00073 #endif

Generated on Sun Sep 19 2010 14:35:14 for GenericMathTemplateLibrary by  doxygen 1.7.1