git-svn-id: https://profuse.googlecode.com/svn/branches/v2@184 aa027e90-d47c-11dd-86d7-074df07e0730

This commit is contained in:
ksherlock 2009-12-16 01:34:33 +00:00
parent bd063227e2
commit d10aacbe93
3 changed files with 13 additions and 5 deletions

View File

@ -38,19 +38,27 @@
void writeZero(unsigned count)
{
uint8_t *cp = _offset + (uint8_t *)_buffer;
for (unsigned i = 0; i < count; ++i)
{
cp[i] = 0;
}
std::memset(_offset + (uint8_t *)_buffer, 0, count);
_offset += count;
}
unsigned offset() const { return _offset; }
void setOffset(unsigned offset) { _offset = offset; }
void setOffset(unsigned offset, bool zero)
{
if (zero && offset > _offset)
{
writeZero(offset - _offset);
}
else setOffset(offset);
}
unsigned size() const { return _size; }
void *buffer() const { return _buffer; }
private:
void *_buffer;
unsigned _size;