Skip to content

Commit ad10690

Browse files
committed
GPU: Fix codechecker violations
1 parent cc900d7 commit ad10690

File tree

2 files changed

+26
-17
lines changed

2 files changed

+26
-17
lines changed

GPU/Common/GPUCommonAlgorithm.h

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -114,32 +114,37 @@ GPUdi() I GPUCommonAlgorithm::MedianOf3Select(I f, I l, Cmp cmp) noexcept
114114
--l;
115115

116116
if (cmp(*f, *m)) {
117-
if (cmp(*m, *l))
117+
if (cmp(*m, *l)) {
118118
return m;
119-
else if (cmp(*f, *l))
119+
} else if (cmp(*f, *l)) {
120120
return l;
121-
else
121+
} else {
122122
return f;
123-
} else if (cmp(*f, *l))
123+
}
124+
} else if (cmp(*f, *l)) {
124125
return f;
125-
else if (cmp(*m, *l))
126+
} else if (cmp(*m, *l)) {
126127
return l;
127-
else
128+
} else {
128129
return m;
130+
}
129131
}
130132

131133
template <typename I, typename T, typename Cmp>
132134
GPUdi() I GPUCommonAlgorithm::UnguardedPartition(I f, I l, T piv, Cmp cmp) noexcept
133135
{
134136
do {
135-
while (cmp(*f, piv))
137+
while (cmp(*f, piv)) {
136138
++f;
139+
}
137140
--l;
138-
while (cmp(piv, *l))
141+
while (cmp(piv, *l)) {
139142
--l;
143+
}
140144

141-
if (l <= f)
145+
if (l <= f) {
142146
return f;
147+
}
143148
IterSwap(f, l);
144149
++f;
145150
} while (true);
@@ -148,10 +153,9 @@ GPUdi() I GPUCommonAlgorithm::UnguardedPartition(I f, I l, T piv, Cmp cmp) noexc
148153
template <typename I, typename Cmp>
149154
GPUdi() void GPUCommonAlgorithm::QuickSort(I f, I l, Cmp cmp) noexcept
150155
{
151-
if (f == l)
152-
156+
if (f == l) {
153157
return;
154-
158+
}
155159
using IndexType = unsigned short;
156160

157161
struct pair {
@@ -186,15 +190,19 @@ GPUdi() void GPUCommonAlgorithm::QuickSort(I f, I l, Cmp cmp) noexcept
186190
const auto lsz = pp - it0;
187191
const auto rsz = it1 - pp;
188192
if (lsz < rsz) {
189-
if (rsz > cutoff)
193+
if (rsz > cutoff) {
190194
s.emplace(pp - f, it1 - f);
191-
if (lsz > cutoff)
195+
}
196+
if (lsz > cutoff) {
192197
s.emplace(it0 - f, pp - f);
198+
}
193199
} else {
194-
if (lsz > cutoff)
200+
if (lsz > cutoff) {
195201
s.emplace(it0 - f, pp - f);
196-
if (rsz > cutoff)
202+
}
203+
if (rsz > cutoff) {
197204
s.emplace(pp - f, it1 - f);
205+
}
198206
}
199207
}
200208
InsertionSort(f, l, cmp);

GPU/TPCFastTransformation/SplineHelper.cxx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,8 +351,9 @@ void SplineHelper<DataT>::approximateFunction(
351351
}
352352
// get the knotindexvalue for FParameters:
353353
int knotind = pointstoarray(knotindices, numberOfKnots, mXdimensions);
354-
for (int f = 0; f < mFdimensions; f++)
354+
for (int f = 0; f < mFdimensions; f++) {
355355
Fparameters[knotind * numberOfParameterTypes * mFdimensions + p * mFdimensions + f] = par[dimension][2 * i * mFdimensions + mFdimensions + f]; ///write derivatives in FParameters
356+
}
356357
}
357358
} // end for all fknots (for redistribution)
358359

0 commit comments

Comments
 (0)