Fix for compile problem in 64-bit mode.

This commit is contained in:
David Williams 2009-09-01 19:01:41 +00:00
parent 10c0f794b1
commit 094d279f74

View File

@ -146,13 +146,12 @@ namespace PolyVox
template <typename VoxelType> template <typename VoxelType>
void Block<VoxelType>::fill(VoxelType tValue) void Block<VoxelType>::fill(VoxelType tValue)
{ {
memset(m_tData, (int)tValue, m_uSideLength * m_uSideLength * m_uSideLength * sizeof(VoxelType)); //The memset *may* be faster than the std::fill(), but it doesn't compile nicely
//This next block fixes the compile error on Linux //in 64-bit mode as casting the pointer to an int causes a loss of precision.
/*const uint32_t uNoOfVoxels = m_uSideLength * m_uSideLength * m_uSideLength;
for(uint32_t ct = 0; ct < uNoOfVoxels; ++ct) //memset(m_tData, (int)tValue, m_uSideLength * m_uSideLength * m_uSideLength * sizeof(VoxelType));
{ const uint32_t uNoOfVoxels = m_uSideLength * m_uSideLength * m_uSideLength;
m_tData[ct] = tValue; std::fill(m_tData, m_tData + uNoOfVoxels, tValue);
}*/
} }
template <typename VoxelType> template <typename VoxelType>