Blaze 3.9
ShiftRI.h
Go to the documentation of this file.
1//=================================================================================================
33//=================================================================================================
34
35#ifndef _BLAZE_MATH_FUNCTORS_SHIFTRI_H_
36#define _BLAZE_MATH_FUNCTORS_SHIFTRI_H_
37
38
39//*************************************************************************************************
40// Includes
41//*************************************************************************************************
42
43#include <utility>
61#include <blaze/system/Inline.h>
62
63
64namespace blaze {
65
66//=================================================================================================
67//
68// CLASS DEFINITION
69//
70//=================================================================================================
71
72//*************************************************************************************************
76struct ShiftRI
77{
78 public:
79 //**********************************************************************************************
84 explicit inline ShiftRI( int count )
85 : count_( count ) // The number of bits to shift
86 {}
87 //**********************************************************************************************
88
89 //**********************************************************************************************
95 template< typename T >
96 BLAZE_ALWAYS_INLINE decltype(auto) operator()( T&& a ) const
97 {
98 return std::forward<T>( a ) >> count_;
99 }
100 //**********************************************************************************************
101
102 //**********************************************************************************************
107 template< typename T >
108 static constexpr bool simdEnabled() { return HasSIMDShiftRI_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//*************************************************************************************************
151template< typename T >
152struct YieldsUniform<ShiftRI,T>
153 : public IsUniform<T>
154{};
156//*************************************************************************************************
157
158
159
160
161//=================================================================================================
162//
163// YIELDSSYMMETRIC SPECIALIZATIONS
164//
165//=================================================================================================
166
167//*************************************************************************************************
169template< typename MT >
170struct YieldsSymmetric<ShiftRI,MT>
171 : public BoolConstant< IsSymmetric_v<MT> >
172{};
174//*************************************************************************************************
175
176
177
178
179//=================================================================================================
180//
181// YIELDSLOWER SPECIALIZATIONS
182//
183//=================================================================================================
184
185//*************************************************************************************************
187template< typename MT >
188struct YieldsLower<ShiftRI,MT>
189 : public IsLower<MT>
190{};
192//*************************************************************************************************
193
194
195
196
197//=================================================================================================
198//
199// YIELDSSTRICTLYLOWER SPECIALIZATIONS
200//
201//=================================================================================================
202
203//*************************************************************************************************
205template< typename MT >
206struct YieldsStrictlyLower<ShiftRI,MT>
207 : public IsStrictlyLower<MT>
208{};
210//*************************************************************************************************
211
212
213
214
215//=================================================================================================
216//
217// YIELDSUPPER SPECIALIZATIONS
218//
219//=================================================================================================
220
221//*************************************************************************************************
223template< typename MT >
224struct YieldsUpper<ShiftRI,MT>
225 : public IsUpper<MT>
226{};
228//*************************************************************************************************
229
230
231
232
233//=================================================================================================
234//
235// YIELDSSTRICTLYUPPER SPECIALIZATIONS
236//
237//=================================================================================================
238
239//*************************************************************************************************
241template< typename MT >
242struct YieldsStrictlyUpper<ShiftRI,MT>
243 : public IsStrictlyUpper<MT>
244{};
246//*************************************************************************************************
247
248
249
250
251//=================================================================================================
252//
253// YIELDSZERO SPECIALIZATIONS
254//
255//=================================================================================================
256
257//*************************************************************************************************
259template< typename T >
260struct YieldsZero<ShiftRI,T>
261 : public IsZero<T>
262{};
264//*************************************************************************************************
265
266} // namespace blaze
267
268#endif
Header file for the HasSIMDShiftRI type trait.
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
IntegralConstant< bool, B > BoolConstant
Generic wrapper for a compile time constant boolean value.
Definition: IntegralConstant.h:110
Header file for the SIMD right-shift functionality.
Compile time check for uniform vectors and matrices.
Definition: IsUniform.h:107
Generic wrapper for the uniform right-shift operation.
Definition: ShiftRI.h:77
int count_
The number of bits to shift.
Definition: ShiftRI.h:135
ShiftRI(int count)
Constructor of the ShiftRI functor.
Definition: ShiftRI.h:84
BLAZE_ALWAYS_INLINE decltype(auto) load(const T &a) const
Returns the result of the uniform right-shift operation for the given SIMD vector.
Definition: ShiftRI.h:126
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition: ShiftRI.h:116
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data type T.
Definition: ShiftRI.h:108
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.