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>
32 #include <blaze/util/Complex.h>
36 
37 
38 namespace blaze {
39 
40 //=================================================================================================
41 //
42 // SIZETRAIT CLASS DEFINITION
43 //
44 //=================================================================================================
45 
46 //*************************************************************************************************
64 template< typename T >
66 {
67  public:
68  //**Member enumerations*************************************************************************
70 #if BLAZE_MIC_MODE
71  enum { value = ( IsVectorizable<T>::value )?( 64UL ):( boost::alignment_of<T>::value ) };
72 #elif BLAZE_SSE2_MODE
73  enum { value = ( IsVectorizable<T>::value )?( 16UL ):( boost::alignment_of<T>::value ) };
74 #else
75  enum { value = boost::alignment_of<T>::value };
76 #endif
77 
78  //**********************************************************************************************
79 
80  private:
81  //**Compile time checks*************************************************************************
86  //**********************************************************************************************
87 };
88 //*************************************************************************************************
89 
90 
91 //*************************************************************************************************
96 template<>
97 struct AlignmentTrait<float>
98 {
99  public:
100  //**Member enumerations*************************************************************************
101 #if BLAZE_MIC_MODE
102  enum { value = 64UL };
103 #elif BLAZE_AVX_MODE
104  enum { value = 32UL };
105 #elif BLAZE_SSE_MODE
106  enum { value = 16UL };
107 #else
108  enum { value = boost::alignment_of<float>::value };
109 #endif
110  //**********************************************************************************************
111 };
113 //*************************************************************************************************
114 
115 
116 //*************************************************************************************************
121 template<>
122 struct AlignmentTrait<double>
123 {
124  public:
125  //**Member enumerations*************************************************************************
126 #if BLAZE_MIC_MODE
127  enum { value = 64UL };
128 #elif BLAZE_AVX_MODE
129  enum { value = 32UL };
130 #elif BLAZE_SSE_MODE
131  enum { value = 16UL };
132 #else
133  enum { value = boost::alignment_of<double>::value };
134 #endif
135  //**********************************************************************************************
136 };
138 //*************************************************************************************************
139 
140 
141 //*************************************************************************************************
146 template<>
147 struct AlignmentTrait< complex<float> >
148 {
149  public:
150  //**Member enumerations*************************************************************************
151 #if BLAZE_MIC_MODE
152  enum { value = 64UL };
153 #elif BLAZE_AVX_MODE
154  enum { value = 32UL };
155 #elif BLAZE_SSE_MODE
156  enum { value = 16UL };
157 #else
158  enum { value = boost::alignment_of< complex<float> >::value };
159 #endif
160  //**********************************************************************************************
161 };
163 //*************************************************************************************************
164 
165 
166 //*************************************************************************************************
171 template<>
172 struct AlignmentTrait< complex<double> >
173 {
174  public:
175  //**Member enumerations*************************************************************************
176 #if BLAZE_MIC_MODE
177  enum { value = 64UL };
178 #elif BLAZE_AVX_MODE
179  enum { value = 32UL };
180 #elif BLAZE_SSE_MODE
181  enum { value = 16UL };
182 #else
183  enum { value = boost::alignment_of< complex<double> >::value };
184 #endif
185  //**********************************************************************************************
186 };
188 //*************************************************************************************************
189 
190 } // namespace blaze
191 
192 #endif