All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AlignmentTrait.h
Go to the documentation of this file.
1 //=================================================================================================
20 //=================================================================================================
21 
22 #ifndef _BLAZE_UTIL_ALIGNMENTTRAIT_H_
23 #define _BLAZE_UTIL_ALIGNMENTTRAIT_H_
24 
25 
26 //*************************************************************************************************
27 // Includes
28 //*************************************************************************************************
29 
30 #include <boost/type_traits/alignment_of.hpp>
31 #include <blaze/system/SSE.h>
35 
36 
37 namespace blaze {
38 
39 //=================================================================================================
40 //
41 // SIZETRAIT CLASS DEFINITION
42 //
43 //=================================================================================================
44 
45 //*************************************************************************************************
63 template< typename T >
65 {
66  public:
67  //**Member enumerations*************************************************************************
69 #if BLAZE_MIC_MODE
70  enum { value = ( IsVectorizable<T>::value )?( 64UL ):( boost::alignment_of<T>::value ) };
71 #elif BLAZE_SSE2_MODE
72  enum { value = ( IsVectorizable<T>::value )?( 16UL ):( boost::alignment_of<T>::value ) };
73 #else
74  enum { value = boost::alignment_of<T>::value };
75 #endif
76 
77  //**********************************************************************************************
78 
79  private:
80  //**Compile time checks*************************************************************************
85  //**********************************************************************************************
86 };
87 //*************************************************************************************************
88 
89 
90 //*************************************************************************************************
95 template<>
96 struct AlignmentTrait<float>
97 {
98  public:
99  //**Member enumerations*************************************************************************
100 #if BLAZE_MIC_MODE
101  enum { value = 64UL };
102 #elif BLAZE_AVX_MODE
103  enum { value = 32UL };
104 #elif BLAZE_SSE_MODE
105  enum { value = 16UL };
106 #else
107  enum { value = boost::alignment_of<float>::value };
108 #endif
109  //**********************************************************************************************
110 };
112 //*************************************************************************************************
113 
114 
115 //*************************************************************************************************
120 template<>
121 struct AlignmentTrait<double>
122 {
123  public:
124  //**Member enumerations*************************************************************************
125 #if BLAZE_MIC_MODE
126  enum { value = 64UL };
127 #elif BLAZE_AVX_MODE
128  enum { value = 32UL };
129 #elif BLAZE_SSE_MODE
130  enum { value = 16UL };
131 #else
132  enum { value = boost::alignment_of<double>::value };
133 #endif
134  //**********************************************************************************************
135 };
137 //*************************************************************************************************
138 
139 } // namespace blaze
140 
141 #endif