Modify the code to avoid some false positives reported by the clang and
gcc static analyzers.
r = v;
do {
while (l < v && x[l] < piv) l++;
- while (x[r] > piv) r--;
+ while (r > 0 && x[r] > piv) r--;
if (r <= l) break;
EXCH(x[l], x[r]);
l++;
sd_weight += (peer_distances[i] - min_distance) / sd;
weights[i] = SQUARE(sd_weight);
}
- }
- correct_asymmetry(inst, times_back, offsets);
+ correct_asymmetry(inst, times_back, offsets);
+ }
inst->regression_ok = RGR_FindBestRegression(times_back + inst->runs_samples,
offsets + inst->runs_samples, weights,
return k0 + (temp - T0) * k1 + (temp - T0) * (temp - T0) * k2;
/* Otherwise interpolate/extrapolate between two nearest points */
-
- for (i = 1; i < ARR_GetSize(points); i++) {
- p2 = (struct Point *)ARR_GetElement(points, i);
- if (p2->temp >= temp)
+ for (i = 1; ; i++) {
+ p2 = ARR_GetElement(points, i);
+ if (p2->temp >= temp || i + 1 >= ARR_GetSize(points))
break;
}
p1 = p2 - 1;