mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-08 13:23:51 +00:00
Silence warning about cast losing precision
When using math operators on small integers, the numbers are promoted to 32-bit ints. If that is set back to the same type, then some compilers give a warning. This is annoying and pointless when dealing with templated types, but we have to deal with it.
This commit is contained in:
parent
3c4e8a2ea5
commit
f8fd0ce316
@ -59,8 +59,8 @@ vtkm::cont::ArrayHandle<T> MakeExpectedOutput(const vtkm::cont::ArrayHandle<T, S
|
||||
ComponentType num = 0;
|
||||
for (vtkm::Id fullI = reducedI; fullI < inputArray.GetNumberOfValues(); fullI += REDUCED_SIZE)
|
||||
{
|
||||
sum = sum + inputPortal.Get(fullI);
|
||||
num = num + ComponentType(1);
|
||||
sum = static_cast<T>(sum + inputPortal.Get(fullI));
|
||||
num = static_cast<ComponentType>(num + ComponentType(1));
|
||||
}
|
||||
outputPortal.Set(reducedI, sum / T(num));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user