Blaze  3.6
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 
60 #include <blaze/system/Inline.h>
61 
62 
63 namespace blaze {
64 
65 //=================================================================================================
66 //
67 // CLASS DEFINITION
68 //
69 //=================================================================================================
70 
71 //*************************************************************************************************
75 struct ShiftRI
76 {
77  public:
78  //**********************************************************************************************
83  explicit inline ShiftRI( int count )
84  : count_( count ) // The number of bits to shift
85  {}
86  //**********************************************************************************************
87 
88  //**********************************************************************************************
94  template< typename T >
95  BLAZE_ALWAYS_INLINE decltype(auto) operator()( const T& a ) const
96  {
97  return a >> count_;
98  }
99  //**********************************************************************************************
100 
101  //**********************************************************************************************
106  template< typename T >
107  static constexpr bool simdEnabled() { return HasSIMDShiftRI_v<T>; }
108  //**********************************************************************************************
109 
110  //**********************************************************************************************
115  static constexpr bool paddingEnabled() { return true; }
116  //**********************************************************************************************
117 
118  //**********************************************************************************************
124  template< typename T >
125  BLAZE_ALWAYS_INLINE decltype(auto) load( const T& a ) const
126  {
128  return a >> count_;
129  }
130  //**********************************************************************************************
131 
132  private:
133  //**Member variables****************************************************************************
134  int count_;
135  //**********************************************************************************************
136 };
137 //*************************************************************************************************
138 
139 
140 
141 
142 //=================================================================================================
143 //
144 // YIELDSUNIFORM SPECIALIZATIONS
145 //
146 //=================================================================================================
147 
148 //*************************************************************************************************
150 template< typename T >
151 struct YieldsUniform<ShiftRI,T>
152  : public IsUniform<T>
153 {};
155 //*************************************************************************************************
156 
157 
158 
159 
160 //=================================================================================================
161 //
162 // YIELDSSYMMETRIC SPECIALIZATIONS
163 //
164 //=================================================================================================
165 
166 //*************************************************************************************************
168 template< typename MT >
169 struct YieldsSymmetric<ShiftRI,MT>
170  : public BoolConstant< IsSymmetric_v<MT> >
171 {};
173 //*************************************************************************************************
174 
175 
176 
177 
178 //=================================================================================================
179 //
180 // YIELDSLOWER SPECIALIZATIONS
181 //
182 //=================================================================================================
183 
184 //*************************************************************************************************
186 template< typename MT >
187 struct YieldsLower<ShiftRI,MT>
188  : public IsLower<MT>
189 {};
191 //*************************************************************************************************
192 
193 
194 
195 
196 //=================================================================================================
197 //
198 // YIELDSSTRICTLYLOWER SPECIALIZATIONS
199 //
200 //=================================================================================================
201 
202 //*************************************************************************************************
204 template< typename MT >
205 struct YieldsStrictlyLower<ShiftRI,MT>
206  : public IsStrictlyLower<MT>
207 {};
209 //*************************************************************************************************
210 
211 
212 
213 
214 //=================================================================================================
215 //
216 // YIELDSUPPER SPECIALIZATIONS
217 //
218 //=================================================================================================
219 
220 //*************************************************************************************************
222 template< typename MT >
223 struct YieldsUpper<ShiftRI,MT>
224  : public IsUpper<MT>
225 {};
227 //*************************************************************************************************
228 
229 
230 
231 
232 //=================================================================================================
233 //
234 // YIELDSSTRICTLYUPPER SPECIALIZATIONS
235 //
236 //=================================================================================================
237 
238 //*************************************************************************************************
240 template< typename MT >
241 struct YieldsStrictlyUpper<ShiftRI,MT>
242  : public IsStrictlyUpper<MT>
243 {};
245 //*************************************************************************************************
246 
247 
248 
249 
250 //=================================================================================================
251 //
252 // YIELDSZERO SPECIALIZATIONS
253 //
254 //=================================================================================================
255 
256 //*************************************************************************************************
258 template< typename T >
259 struct YieldsZero<ShiftRI,T>
260  : public IsZero<T>
261 {};
263 //*************************************************************************************************
264 
265 } // namespace blaze
266 
267 #endif
decltype(auto) BLAZE_ALWAYS_INLINE load(const T &a) const
Returns the result of the uniform right-shift operation for the given SIMD vector.
Definition: ShiftRI.h:125
Compile time check for operations on vectors and matrices.This type trait tests whether or not the gi...
Definition: YieldsUniform.h:66
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
int count_
The number of bits to shift.
Definition: ShiftRI.h:134
Header file for the SIMD right-shift functionality.
#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
ShiftRI(int count)
Constructor of the ShiftRI functor.
Definition: ShiftRI.h:83
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.
static constexpr bool simdEnabled()
Returns whether SIMD is enabled for the specified data type T.
Definition: ShiftRI.h:107
Header file for the IsStrictlyLower type trait.
Header file for the HasSIMDShiftRI type trait.
Header file for the YieldsUniform type trait.
Header file for the YieldsSymmetric type trait.
static constexpr bool paddingEnabled()
Returns whether the operation supports padding, i.e. whether it can deal with zeros.
Definition: ShiftRI.h:115
Header file for the YieldsUpper type trait.
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
Header file for the IsUpper type trait.
System settings for the inline keywords.
Generic wrapper for the uniform right-shift operation.
Definition: ShiftRI.h:75