File tree Expand file tree Collapse file tree
GPUTracking/DataCompression Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5656 #define CONSTEXPR constexpr
5757 #define CONSTEXPRRET CONSTEXPR
5858 #if defined(__cplusplus) && __cplusplus >= 201703L
59- #define CONSTEXPRIF if constexpr
6059 #define CONSTEXPR17 constexpr
6160 #else
62- #define CONSTEXPRIF if
6361 #define CONSTEXPR17
6462 #endif
6563#else
6664 #define CON_DELETE
6765 #define CON_DEFAULT
6866 #define CONSTEXPR const
69- #define CONSTEXPRIF if
7067 #define CONSTEXPR17
7168 #define CONSTEXPRRET
7269#endif
Original file line number Diff line number Diff line change @@ -148,10 +148,15 @@ class GPUCommonMath
148148 GPUd () CONSTEXPR17 static T nextMultipleOf (T val);
149149
150150#ifdef GPUCA_NOCOMPAT
151+ GPUdi () static float Sum2() // Needed for legacy C++, For >=17 the below if constexpr handles the case
152+ {
153+ return 0 .f ;
154+ }
155+
151156 template <typename ... Args>
152157 GPUdi () static float Sum2(float w, Args... args)
153158 {
154- if constexpr (sizeof ...(Args) == 0 ) {
159+ if CONSTEXPR17 (sizeof ...(Args) == 0 ) {
155160 return w * w;
156161 } else {
157162 return w * w + Sum2 (args...);
@@ -185,16 +190,13 @@ typedef GPUCommonMath CAMath;
185190template <int I, class T >
186191GPUdi () CONSTEXPR17 T GPUCommonMath::nextMultipleOf (T val)
187192{
188- CONSTEXPRIF (I & (I - 1 ))
189- {
193+ if CONSTEXPR17 (I & (I - 1 )) {
190194 T tmp = val % I;
191195 if (tmp) {
192196 val += I - tmp;
193197 }
194198 return val;
195- }
196- else
197- {
199+ } else {
198200 return (val + I - 1 ) & ~(T)(I - 1 );
199201 }
200202 return 0 ; // BUG: Cuda complains about missing return value with constexpr if
Original file line number Diff line number Diff line change @@ -339,13 +339,10 @@ GPUdi() GPUTPCCompressionGatherKernels::Vec128* GPUTPCCompressionGatherKernels::
339339template <typename T, typename S>
340340GPUdi () bool GPUTPCCompressionGatherKernels::isAlignedTo(const S* ptr)
341341{
342- CONSTEXPRIF (alignof (S) >= alignof (T))
343- {
342+ if CONSTEXPR17 (alignof (S) >= alignof (T)) {
344343 static_cast <void >(ptr);
345344 return true ;
346- }
347- else
348- {
345+ } else {
349346 return reinterpret_cast <size_t >(ptr) % alignof (T) == 0 ;
350347 }
351348 return false ; // BUG: Cuda complains about missing return value with constexpr if
You can’t perform that action at this time.
0 commit comments