mirror of
https://github.com/ksherlock/profuse.git
synced 2025-01-07 17:31:37 +00:00
git-svn-id: https://profuse.googlecode.com/svn/branches/v2@184 aa027e90-d47c-11dd-86d7-074df07e0730
This commit is contained in:
parent
bd063227e2
commit
d10aacbe93
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user