Blaze  3.6
ShiftLI.h
Go to the documentation of this file.
1 //=================================================================================================
33 //=================================================================================================
34 
35 #ifndef _BLAZE_MATH_FUNCTORS_SHIFTLI_H_
36 #define _BLAZE_MATH_FUNCTORS_SHIFTLI_H_
37 
38 
39 //*************************************************************************************************
40 // Includes
41 //*************************************************************************************************
42 
61 #include <blaze/system/Inline.h>
62 
63 
64 namespace blaze {
65 
66 //=================================================================================================
67 //
68 // CLASS DEFINITION
69 //
70 //=================================================================================================
71 
72 //*************************************************************************************************
76 struct ShiftLI
77 {
78  public:
79  //**********************************************************************************************
84  explicit inline ShiftLI( int count )
85  : count_( count ) // The number of bits to shift
86  {}
87  //**********************************************************************************************
88 
89  //**********************************************************************************************
95  template< typename T >
96  BLAZE_ALWAYS_INLINE BLAZE_DEVICE_CALLABLE decltype(auto) operator()( const T& a ) const
97  {
98  return a << count_;
99  }
100  //**********************************************************************************************
101 
102  //**********************************************************************************************
107  template< typename T >
108  static constexpr bool simdEnabled() { return HasSIMDShiftLI_v<T>; }
109  //**********************************************************************************************
110 
111  //**********************************************************************************************
116  static constexpr bool paddingEnabled() { return true; }
117  //**********************************************************************************************
118 
119  //**********************************************************************************************
125  template< typename T >
126  BLAZE_ALWAYS_INLINE decltype(auto) load( const T& a ) const
127  {
129  return a << count_;
130  }
131  //**********************************************************************************************
132 
133  private:
134  //**Member variables****************************************************************************
135  int count_;
136  //**********************************************************************************************
137 };
138 //*************************************************************************************************
139 
140 
141 
142 
143 //=================================================================================================
144 //
145 // YIELDSUNIFORM SPECIALIZATIONS
146 //
147 //=================================================================================================
148 
149 //*************************************************************************************************
151 template< typename T >
152 struct YieldsUniform<ShiftLI,T>
153  : public IsUniform<T>
154 {};
156 //*************************************************************************************************
157 
158 
159 
160 
161 //=================================================================================================
162 //
163 // YIELDSSYMMETRIC SPECIALIZATIONS
164 //
165 //=================================================================================================
166 
167 //*************************************************************************************************
169 template< typename MT >
170 struct YieldsSymmetric<ShiftLI,MT>
171  : public BoolConstant< IsSymmetric_v<MT> >
172 {};
174 //*************************************************************************************************
175 
176 
177 
178 
179 //=================================================================================================
180 //
181 // YIELDSLOWER SPECIALIZATIONS
182 //
183 //=================================================================================================
184 
185 //*************************************************************************************************
187 template< typename MT >
188 struct YieldsLower<ShiftLI,MT>
189  : public IsLower<MT>
190 {};
192 //*************************************************************************************************
193 
194 
195 
196 
197 //=================================================================================================
198 //
199 // YIELDSSTRICTLYLOWER SPECIALIZATIONS
200 //
201 //=================================================================================================
202 
203 //*************************************************************************************************
205 template< typename MT >
206 struct YieldsStrictlyLower<ShiftLI,MT>
207  : public IsStrictlyLower<MT>
208 {};
210 //*************************************************************************************************
211 
212 
213 
214 
215 //=================================================================================================
216 //
217 // YIELDSUPPER SPECIALIZATIONS
218 //
219 //=================================================================================================
220 
221 //*************************************************************************************************
223 template< typename MT >
224 struct YieldsUpper<ShiftLI,MT>
225  : public IsUpper<MT>
226 {};
228 //*************************************************************************************************
229 
230 
231 
232 
233 //=================================================================================================
234 //
235 // YIELDSSTRICTLYUPPER SPECIALIZATIONS
236 //
237 //=================================================================================================
238 
239 //*************************************************************************************************
241 template< typename MT >
242 struct YieldsStrictlyUpper<ShiftLI,MT>
243  : public IsStrictlyUpper<MT>
244 {};
246 //*************************************************************************************************
247 
248 
249 
250 
251 //=================================================================================================
252 //
253 // YIELDSZERO SPECIALIZATIONS
254 //
255 //=================================================================================================
256 
257 //*************************************************************************************************
259 template< typename T >
260 struct YieldsZero<ShiftLI,T>
261  : public IsZero<T>
262 {};
264 //*************************************************************************************************
265 
266 } // namespace blaze
267 
268 #endif
Compile time check for operations on vectors and matrices.This type trait tests whether or not the gi...
Definition: YieldsUniform.h:66
Generic wrapper for the uniform left-shift operation.
Definition: ShiftLI.h:76
Header file for the YieldsStrictlyLower type trait.
Header file for the YieldsZero type trait.
Compile time check for uniform vectors and matrices.This type trait tests whether or not the given te...
Definition: IsUniform.h:105
decltype(auto) BLAZE_ALWAYS_INLINE load(const T &a) const
Returns the result of the uniform left-shift operation for the given SIMD vector.
Definition: ShiftLI.h:126
Header file for the HasSIMDShiftLI type trait.
int count_
The number of bits to shift.
Definition: ShiftLI.h:135
#define BLAZE_CONSTRAINT_MUST_BE_SIMD_PACK(T)
Constraint on the data type.In case the given data type T is not a SIMD pack, a compilation error is ...
Definition: SIMDPack.h:60
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition: ShiftLI.h:116
Header file for the IsUniform type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Namespace of the Blaze C++ math library.
Definition: Blaze.h:58
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
Header file for the YieldsStrictlyUpper type trait.
Header file for the IsLower type trait.
Constraint on the data type.
Header file for the IsStrictlyLower type trait.
ShiftLI(int count)
Constructor of the ShiftLI functor.
Definition: ShiftLI.h:84
Header file for the YieldsUniform type trait.
Header file for the YieldsSymmetric type trait.
Header file for the YieldsUpper type trait.
Header file for the SIMD left-shift functionality.
Header file for the IsZero type trait.
Header file for the YieldsLower type trait.
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.The BoolConstant alias template represents ...
Definition: IntegralConstant.h:110
Macro for CUDA compatibility.
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data type T.
Definition: ShiftLI.h:108
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
Header file for the IsUpper type trait.
System settings for the inline keywords.