Skip to content

Commit

Permalink
clean up asserts for getField/setField
Browse files Browse the repository at this point in the history
  • Loading branch information
hobu committed Dec 21, 2013
1 parent 8cfe75c commit 64c93b5
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions include/pdal/PointBuffer.hpp
Expand Up @@ -457,9 +457,7 @@ inline void PointBuffer::setField(pdal::Dimension const& dim, boost::uint32_t po
throw buffer_error("unknown pdal::Schema::m_orientation provided!");
}

#ifdef DEBUG
assert(offset + sizeof(T) <= getBufferByteSize());
#endif
assert(offset + sizeof(T) <= getBufferByteLength());

boost::uint8_t* p = (boost::uint8_t*)&(m_data.front()) + offset;

Expand Down Expand Up @@ -511,19 +509,7 @@ inline T const& PointBuffer::getField(pdal::Dimension const& dim, boost::uint32
throw buffer_error("unknown pdal::Schema::m_orientation provided!");
}

#ifdef DEBUG
// This test ends up being somewhat expensive when run for every field
// for every point.

if (offset + sizeof(T) > getBufferByteSize())
{
std::ostringstream oss;
oss << "Offset for given dimension is off the end of the buffer!";
throw buffer_error(oss.str());
}

assert(offset + sizeof(T) <= getBufferByteSize() );
#endif
assert(offset + sizeof(T) <= getBufferByteLength());

boost::uint8_t const* p = (boost::uint8_t const*)&(m_data.front()) + offset;
T const& output = *(T const*)(void const*)p;
Expand Down

0 comments on commit 64c93b5

Please sign in to comment.