Skip to content

Commit c27ffb9

Browse files
committed
COMP: Remove compiler warnings
1 parent 9f5e516 commit c27ffb9

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

test/itkHighPriorityRealTimeProbeTest.cxx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,12 +68,17 @@ itkHighPriorityRealTimeProbeTest(int, char *[])
6868
localTimer.Start();
6969

7070
double sum = 0.0;
71-
for (unsigned int i = 0; i < 1e6; ++i)
71+
constexpr unsigned int big_stopping_criteria=1e6;
72+
for (unsigned int i = 0; i < big_stopping_criteria; ++i)
7273
{
7374
sum += i;
7475
}
7576

7677
localTimer.Stop();
78+
// Need to use the variable sum to ensure that it is not optimized away.
79+
std::cout << " Time for simple addition summing loop with "
80+
<< big_stopping_criteria << " iterations: "
81+
<< localTimer.GetMean() << " sum = (" << sum << ")\n";
7782
}
7883

7984
if (!CheckTimeProbe(localTimer))

test/itkHighPriorityRealTimeProbesCollectorTest.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ TestTransformPhysicalPointToIndex(T * image)
6363
for (int i = 0; i < 1000; i++)
6464
{
6565
point3D[0] = static_cast<typename itk::NumericTraits<typename T::PointType>::ValueType>(i);
66-
image->TransformPhysicalPointToIndex(point3D, index3D);
66+
index3D = image->TransformPhysicalPointToIndex(point3D);
6767
}
6868
}
6969
if (k == 5)
70-
std::cout << point3D << std::endl;
70+
{
71+
std::cout << point3D << " at " << index3D << std::endl;
72+
}
7173
}
7274
}
7375
//-------------------------

test/itkTimeProbeTest2.cxx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,16 @@ itkTimeProbeTest2(int, char *[])
7070
localTimer.Start();
7171

7272
double sum = 0.0;
73-
for (unsigned int i = 0; i < 1e6; ++i)
73+
constexpr unsigned int big_stopping_criteria=1e6;
74+
for (unsigned int i = 0; i < big_stopping_criteria; ++i)
7475
{
7576
sum += i;
7677
}
77-
7878
localTimer.Stop();
79+
// Need to use the variable sum to ensure that it is not optimized away.
80+
std::cout << " Time for simple addition summing loop with "
81+
<< big_stopping_criteria << " iterations: "
82+
<< localTimer.GetMean() << " sum = (" << sum << ")\n";
7983
}
8084

8185
if (!CheckTimeProbe(localTimer))

test/itkTimeProbesTest2.cxx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,13 @@ TestTransformPhysicalPointToIndex(T * image)
6262
for (int i = 0; i < 1000; i++)
6363
{
6464
point3D[0] = static_cast<typename itk::NumericTraits<typename T::PointType>::ValueType>(i);
65-
image->TransformPhysicalPointToIndex(point3D, index3D);
65+
index3D = image->TransformPhysicalPointToIndex(point3D);
6666
}
6767
}
6868
if (k == 5)
69-
std::cout << point3D << std::endl;
69+
{
70+
std::cout << point3D << " at " << index3D << std::endl;
71+
}
7072
}
7173
}
7274
//-------------------------

0 commit comments

Comments
 (0)