Updates will be applied April 15th at 12pm EDT (UTC-0400). GitLab could be a little slow between 12 - 12:45pm EDT.

Commit 209053b7 authored by Kenneth Moreland's avatar Kenneth Moreland

Fix issues with implicitly converting ints to floats

MSVC complains that converting a 32-bit int to a 32-bit float could
cause loss of precision.
parent b2e39ad8
......@@ -77,7 +77,7 @@ public:
VTKM_EXEC_CONT_EXPORT
ValueType Get(vtkm::Id index) const {
return StartingValue + ValueType(ComponentType(index));
return StartingValue + ValueType(static_cast<ComponentType>(index));
}
private:
......
......@@ -24,6 +24,8 @@
#include <vtkm/cont/ArrayHandleImplicit.h>
#include <vtkm/cont/DeviceAdapterSerial.h>
#include <vtkm/VecTraits.h>
#include <vtkm/cont/testing/Testing.h>
namespace {
......@@ -35,7 +37,10 @@ struct IndexSquared
{
VTKM_EXEC_CONT_EXPORT
ValueType operator()(vtkm::Id i) const
{ return ValueType(i*i); }
{
typedef typename vtkm::VecTraits<ValueType>::ComponentType ComponentType;
return ValueType(static_cast<ComponentType>(i*i));
}
};
......
......@@ -166,7 +166,7 @@ struct TransformTests
Portal portal = input.GetPortalControl();
for(vtkm::Id index=0; index < ARRAY_SIZE; ++index)
{
portal.Set(index, InputValueType(index+2) );
portal.Set(index, TestValue(index, InputValueType()) );
}
CheckControlPortals(input, thandle);
......@@ -180,7 +180,7 @@ struct TransformTests
<< std::endl;
for(vtkm::Id index=0; index < ARRAY_SIZE; ++index)
{
portal.Set(index, InputValueType(index*index));
portal.Set(index, TestValue(index*index, InputValueType()));
}
CheckControlPortals(input, thandle);
......
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