The expiration time for new job artifacts in CI/CD pipelines is now 30 days (GitLab default). Previously generated artifacts in already completed jobs will not be affected by the change. The latest artifacts for all jobs in the latest successful pipelines will be kept. More information: https://gitlab.lrz.de/help/user/admin_area/settings/continuous_integration.html#default-artifacts-expiration

Commit 231a7c0f authored by Christian Schulte zu Berge's avatar Christian Schulte zu Berge
Browse files

Fixed some false positive GCC warnings.

parent 1d009b00
......@@ -117,7 +117,7 @@ namespace campvis {
* \param bucketNumbers Array of the bucket number for each dimension (must have at least ND elements).
* \return The array index for the given bucket numbers.
*/
size_t getArrayIndex(size_t* bucketNumbers) const;
size_t getArrayIndex(size_t bucketNumbers[ND]) const;
T _min[ND]; ///< minimum value for each dimension
T _max[ND]; ///< maximum value for each dimension
......@@ -189,11 +189,14 @@ namespace campvis {
}
double ratio = static_cast<double>(sample - _min[dimension]) / static_cast<double>(_max[dimension] - _min[dimension]);
return static_cast<size_t>(tgt::clamp(static_cast<int>(ratio * _numBuckets[dimension]), static_cast<int>(0), static_cast<int>(_numBuckets[dimension]) - 1));
int toReturn = static_cast<int>(ratio * _numBuckets[dimension]);
toReturn = std::max(toReturn, 0);
toReturn = std::min(toReturn, static_cast<int>(_numBuckets[dimension]) - 1);
return toReturn;
}
template<typename T, size_t ND>
size_t campvis::ConcurrentGenericHistogramND<T, ND>::getArrayIndex(size_t* bucketNumbers) const {
size_t campvis::ConcurrentGenericHistogramND<T, ND>::getArrayIndex(size_t bucketNumbers[ND]) const {
size_t index = 0;
size_t multiplier = 1;
for (size_t i = 0; i < ND; ++i) {
......
......@@ -50,7 +50,7 @@ protected:
max = new int[ND];
min = new int[ND];
numBuckets = new size_t[ND];
for (int i = 0; i < ND; i++) {
for (size_t i = 0; i < ND; i++) {
min[i] = 0;
max[i] = 100;
numBuckets[i] = max[i] - min[i] + 1;
......@@ -135,7 +135,8 @@ TEST_F(ConcurrentHistogram1DTest, concurrentAddSampleTest) {
for (int i = 0; i < getND(); i++) {
for (size_t j = 0; j < numBuckets[i]; j ++) {
EXPECT_EQ(histogram[i], _cgh->getNumElements(j));
size_t expected = static_cast<size_t>(histogram[i]);
EXPECT_EQ(expected, _cgh->getNumElements(j));
}
}
}
......@@ -162,7 +163,8 @@ TEST_F(ConcurrentHistogram2DTest, concurrentAddSampleTest) {
for (int i = 0; i < getND(); i++) {
for (size_t j = 0; j < numBuckets[i]; j ++) {
EXPECT_EQ(histogram[i], _cgh->getNumElements(j));
size_t expected = static_cast<size_t>(histogram[i]);
EXPECT_EQ(expected, _cgh->getNumElements(j));
}
break;
}
......@@ -183,7 +185,7 @@ protected:
max = new int[ND];
min = new int[ND];
numBuckets = new size_t[ND];
for (int i = 0; i < ND; i++) {
for (size_t i = 0; i < ND; i++) {
min[i] = 0;
max[i] = 9999;
numBuckets[i] = 2;
......@@ -270,7 +272,8 @@ TEST_F(ConcurrentHistogram1DTestSpecific, concurrentAddSampleTest) {
for (int i = 0; i < getND(); i++) {
for (size_t j = 0; j < numBuckets[i]; j ++) {
EXPECT_EQ(histogram[i], _cgh->getNumElements(j));
size_t expected = static_cast<size_t>(histogram[i]);
EXPECT_EQ(expected, _cgh->getNumElements(j));
}
}
}
......@@ -297,7 +300,8 @@ TEST_F(ConcurrentHistogram2DTestSpecific, concurrentAddSampleTest) {
for (int i = 0; i < getND(); i++) {
for (size_t j = 0; j < numBuckets[i]; j ++) {
EXPECT_EQ(histogram[i], _cgh->getNumElements(j));
size_t expected = static_cast<size_t>(histogram[i]);
EXPECT_EQ(expected, _cgh->getNumElements(j));
}
break;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment