mirror of
https://gitlab.kitware.com/vtk/vtk-m
synced 2024-09-16 17:22:55 +00:00
the random source is still 64 bits
This commit is contained in:
parent
cc3061bab1
commit
5b0e309b95
@ -40,13 +40,13 @@ struct CanonicalFunctor<vtkm::Float64>
|
||||
template <>
|
||||
struct CanonicalFunctor<vtkm::Float32>
|
||||
{
|
||||
// We take 24 bits (number of bits in mantissa in a double) from the 32 bits random source
|
||||
// We take 24 bits (number of bits in mantissa in a double) from the 64 bits random source
|
||||
// and divide it by (1 << 24).
|
||||
static constexpr vtkm::Float32 DIVISOR = static_cast<vtkm::Float32>(vtkm::UInt32{ 1 } << 24);
|
||||
static constexpr vtkm::UInt32 MASK = (vtkm::UInt32{ 1 } << 24) - vtkm::UInt32{ 1 };
|
||||
|
||||
VTKM_EXEC_CONT
|
||||
vtkm::Float32 operator()(vtkm::UInt32 bits) const { return (bits & MASK) / DIVISOR; }
|
||||
vtkm::Float32 operator()(vtkm::UInt64 bits) const { return (bits & MASK) / DIVISOR; }
|
||||
};
|
||||
} // detail
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user