mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-19 02:25:42 +00:00
distingush load/store v.s. arithmetic types
This commit is contained in:
parent
b78f91b067
commit
2336d144e3
@ -52,10 +52,26 @@ struct MakeUnsigned<vtkm::Int64>
|
||||
template <>
|
||||
struct MakeUnsigned<vtkm::Float32>
|
||||
{
|
||||
using type = vtkm::Float32;
|
||||
using type = vtkm::UInt32;
|
||||
};
|
||||
template <>
|
||||
struct MakeUnsigned<vtkm::Float64>
|
||||
{
|
||||
using type = vtkm::UInt64;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ArithType
|
||||
{
|
||||
using type = typename MakeUnsigned<T>::type;
|
||||
};
|
||||
template <>
|
||||
struct ArithType<vtkm::Float32>
|
||||
{
|
||||
using type = vtkm::Float32;
|
||||
};
|
||||
template <>
|
||||
struct ArithType<vtkm::Float64>
|
||||
{
|
||||
using type = vtkm::Float64;
|
||||
};
|
||||
@ -178,7 +194,7 @@ public:
|
||||
// This is safe, since the only difference between signed/unsigned types
|
||||
// is how overflow works, and signed overflow is already undefined. We also
|
||||
// document that overflow is undefined for this operation.
|
||||
using APIType = typename detail::MakeUnsigned<ValueType>::type;
|
||||
using APIType = typename detail::ArithType<ValueType>::type;
|
||||
|
||||
return static_cast<T>(
|
||||
vtkm::AtomicAdd(reinterpret_cast<APIType*>(this->Data + index), static_cast<APIType>(value)));
|
||||
|
Loading…
Reference in New Issue
Block a user