Blaze 3.9
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
43#include <utility>
62#include <blaze/system/Inline.h>
63
64
65namespace blaze {
66
67//=================================================================================================
68//
69// CLASS DEFINITION
70//
71//=================================================================================================
72
73//*************************************************************************************************
77struct ShiftLI
78{
79 public:
80 //**********************************************************************************************
85 explicit inline ShiftLI( int count )
86 : count_( count ) // The number of bits to shift
87 {}
88 //**********************************************************************************************
89
90 //**********************************************************************************************
96 template< typename T >
97 BLAZE_ALWAYS_INLINE BLAZE_DEVICE_CALLABLE decltype(auto) operator()( T&& a ) const
98 {
99 return std::forward<T>( a ) << count_;
100 }
101 //**********************************************************************************************
102
103 //**********************************************************************************************
108 template< typename T >
109 static constexpr bool simdEnabled() { return HasSIMDShiftLI_v<T>; }
110 //**********************************************************************************************
111
112 //**********************************************************************************************
117 static constexpr bool paddingEnabled() { return true; }
118 //**********************************************************************************************
119
120 //**********************************************************************************************
126 template< typename T >
127 BLAZE_ALWAYS_INLINE decltype(auto) load( const T& a ) const
128 {
130 return a << count_;
131 }
132 //**********************************************************************************************
133
134 private:
135 //**Member variables****************************************************************************
136 int count_;
137 //**********************************************************************************************
138};
139//*************************************************************************************************
140
141
142
143
144//=================================================================================================
145//
146// YIELDSUNIFORM SPECIALIZATIONS
147//
148//=================================================================================================
149
150//*************************************************************************************************
152template< typename T >
153struct YieldsUniform<ShiftLI,T>
154 : public IsUniform<T>
155{};
157//*************************************************************************************************
158
159
160
161
162//=================================================================================================
163//
164// YIELDSSYMMETRIC SPECIALIZATIONS
165//
166//=================================================================================================
167
168//*************************************************************************************************
170template< typename MT >
171struct YieldsSymmetric<ShiftLI,MT>
172 : public BoolConstant< IsSymmetric_v<MT> >
173{};
175//*************************************************************************************************
176
177
178
179
180//=================================================================================================
181//
182// YIELDSLOWER SPECIALIZATIONS
183//
184//=================================================================================================
185
186//*************************************************************************************************
188template< typename MT >
189struct YieldsLower<ShiftLI,MT>
190 : public IsLower<MT>
191{};
193//*************************************************************************************************
194
195
196
197
198//=================================================================================================
199//
200// YIELDSSTRICTLYLOWER SPECIALIZATIONS
201//
202//=================================================================================================
203
204//*************************************************************************************************
206template< typename MT >
207struct YieldsStrictlyLower<ShiftLI,MT>
208 : public IsStrictlyLower<MT>
209{};
211//*************************************************************************************************
212
213
214
215
216//=================================================================================================
217//
218// YIELDSUPPER SPECIALIZATIONS
219//
220//=================================================================================================
221
222//*************************************************************************************************
224template< typename MT >
225struct YieldsUpper<ShiftLI,MT>
226 : public IsUpper<MT>
227{};
229//*************************************************************************************************
230
231
232
233
234//=================================================================================================
235//
236// YIELDSSTRICTLYUPPER SPECIALIZATIONS
237//
238//=================================================================================================
239
240//*************************************************************************************************
242template< typename MT >
243struct YieldsStrictlyUpper<ShiftLI,MT>
244 : public IsStrictlyUpper<MT>
245{};
247//*************************************************************************************************
248
249
250
251
252//=================================================================================================
253//
254// YIELDSZERO SPECIALIZATIONS
255//
256//=================================================================================================
257
258//*************************************************************************************************
260template< typename T >
261struct YieldsZero<ShiftLI,T>
262 : public IsZero<T>
263{};
265//*************************************************************************************************
266
267} // namespace blaze
268
269#endif
Header file for the HasSIMDShiftLI type trait.
Macro for CUDA compatibility.
Header file for the IsLower type trait.
Header file for the IsStrictlyLower type trait.
Header file for the IsStrictlyUpper type trait.
Header file for the IsSymmetric type trait.
Header file for the IsUniform type trait.
Header file for the IsUpper type trait.
Header file for the YieldsLower type trait.
Header file for the YieldsStrictlyLower type trait.
Header file for the YieldsStrictlyUpper type trait.
Header file for the YieldsSymmetric type trait.
Header file for the YieldsUniform type trait.
Header file for the YieldsUpper type trait.
Header file for the YieldsZero type trait.
Constraint on the data type.
#define BLAZE_CONSTRAINT_MUST_BE_SIMD_PACK(T)
Constraint on the data type.
Definition: SIMDPack.h:60
#define BLAZE_ALWAYS_INLINE
Platform dependent setup of an enforced inline keyword.
Definition: Inline.h:85
#define BLAZE_DEVICE_CALLABLE
Conditional macro that sets host and device attributes when compiled with CUDA.
Definition: HostDevice.h:94
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.
Definition: IntegralConstant.h:110
Header file for the SIMD left-shift functionality.
Compile time check for uniform vectors and matrices.
Definition: IsUniform.h:107
Generic wrapper for the uniform left-shift operation.
Definition: ShiftLI.h:78
ShiftLI(int count)
Constructor of the ShiftLI functor.
Definition: ShiftLI.h:85
BLAZE_ALWAYS_INLINE decltype(auto) load(const T &a) const
Returns the result of the uniform left-shift operation for the given SIMD vector.
Definition: ShiftLI.h:127
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data type T.
Definition: ShiftLI.h:109
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition: ShiftLI.h:117
int count_
The number of bits to shift.
Definition: ShiftLI.h:136
Compile time check for operations on vectors and matrices.
Definition: YieldsUniform.h:68
System settings for the inline keywords.
Header file for the IsZero type trait.