AlignmentOf.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_UTIL_TYPETRAITS_ALIGNMENTOF_H_
36 #define _BLAZE_UTIL_TYPETRAITS_ALIGNMENTOF_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
43 #include <boost/type_traits/alignment_of.hpp>
45 #include <blaze/util/Complex.h>
47 
48 
49 namespace blaze {
50 
51 //=================================================================================================
52 //
53 // CLASS DEFINITION
54 //
55 //=================================================================================================
56 
57 //*************************************************************************************************
76 template< typename T >
78 {
79  public:
80  //**Member enumerations*************************************************************************
82 #if BLAZE_MIC_MODE
83  enum { value = ( IsVectorizable<T>::value )?( 64UL ):( boost::alignment_of<T>::value ) };
84 #elif BLAZE_AVX2_MODE
85  enum { value = ( IsVectorizable<T>::value )?( 32UL ):( boost::alignment_of<T>::value ) };
86 #elif BLAZE_SSE2_MODE
87  enum { value = ( IsVectorizable<T>::value )?( 16UL ):( boost::alignment_of<T>::value ) };
88 #else
89  enum { value = boost::alignment_of<T>::value };
90 #endif
91 
92  //**********************************************************************************************
93 };
94 //*************************************************************************************************
95 
96 
97 //*************************************************************************************************
102 template<>
103 struct AlignmentOf<float>
104 {
105  public:
106  //**Member enumerations*************************************************************************
107 #if BLAZE_MIC_MODE
108  enum { value = 64UL };
109 #elif BLAZE_AVX_MODE
110  enum { value = 32UL };
111 #elif BLAZE_SSE_MODE
112  enum { value = 16UL };
113 #else
114  enum { value = boost::alignment_of<float>::value };
115 #endif
116  //**********************************************************************************************
117 };
119 //*************************************************************************************************
120 
121 
122 //*************************************************************************************************
127 template<>
128 struct AlignmentOf<double>
129 {
130  public:
131  //**Member enumerations*************************************************************************
132 #if BLAZE_MIC_MODE
133  enum { value = 64UL };
134 #elif BLAZE_AVX_MODE
135  enum { value = 32UL };
136 #elif BLAZE_SSE_MODE
137  enum { value = 16UL };
138 #else
139  enum { value = boost::alignment_of<double>::value };
140 #endif
141  //**********************************************************************************************
142 };
144 //*************************************************************************************************
145 
146 
147 //*************************************************************************************************
152 template<>
153 struct AlignmentOf< complex<float> >
154 {
155  public:
156  //**Member enumerations*************************************************************************
157 #if BLAZE_MIC_MODE
158  enum { value = 64UL };
159 #elif BLAZE_AVX_MODE
160  enum { value = 32UL };
161 #elif BLAZE_SSE_MODE
162  enum { value = 16UL };
163 #else
164  enum { value = boost::alignment_of< complex<float> >::value };
165 #endif
166  //**********************************************************************************************
167 };
169 //*************************************************************************************************
170 
171 
172 //*************************************************************************************************
177 template<>
178 struct AlignmentOf< complex<double> >
179 {
180  public:
181  //**Member enumerations*************************************************************************
182 #if BLAZE_MIC_MODE
183  enum { value = 64UL };
184 #elif BLAZE_AVX_MODE
185  enum { value = 32UL };
186 #elif BLAZE_SSE_MODE
187  enum { value = 16UL };
188 #else
189  enum { value = boost::alignment_of< complex<double> >::value };
190 #endif
191  //**********************************************************************************************
192 };
194 //*************************************************************************************************
195 
196 
197 //*************************************************************************************************
202 template< typename T >
203 struct AlignmentOf< const T >
204 {
205  //**Member enumerations*************************************************************************
206  enum { value = AlignmentOf<T>::value };
207  //**********************************************************************************************
208 };
210 //*************************************************************************************************
211 
212 
213 //*************************************************************************************************
218 template< typename T >
219 struct AlignmentOf< volatile T >
220 {
221  //**Member enumerations*************************************************************************
222  enum { value = AlignmentOf<T>::value };
223  //**********************************************************************************************
224 };
226 //*************************************************************************************************
227 
228 
229 //*************************************************************************************************
234 template< typename T >
235 struct AlignmentOf< const volatile T >
236 {
237  //**Member enumerations*************************************************************************
238  enum { value = AlignmentOf<T>::value };
239  //**********************************************************************************************
240 };
242 //*************************************************************************************************
243 
244 } // namespace blaze
245 
246 #endif
Compile time check for vectorizable types.Depending on the available instruction set (SSE...
Definition: IsVectorizable.h:118
Namespace of the Blaze C++ math library.
Definition: Blaze.h:57
Header file for the IsVectorizable type trait.
System settings for the SSE mode.
Header file for the complex data type.
Evaluation of the required alignment of the given data type.The AlignmentOf type trait template evalu...
Definition: AlignmentOf.h:77