mirror of
https://github.com/thunderbrewhq/squall.git
synced 2025-12-12 10:32:29 +00:00
feat(big): add BigBuffer::SetOffset
This commit is contained in:
parent
69cf4739f3
commit
60edadfe06
2 changed files with 9 additions and 0 deletions
|
|
@ -33,6 +33,14 @@ void BigBuffer::SetCount(uint32_t count) {
|
||||||
this->m_data.SetCount(this->m_offset + count);
|
this->m_data.SetCount(this->m_offset + count);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BigBuffer::SetOffset(uint32_t offset) {
|
||||||
|
this->m_offset = offset;
|
||||||
|
|
||||||
|
if (offset) {
|
||||||
|
this->GrowToFit(0xFFFFFFFF);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void BigBuffer::Trim() const {
|
void BigBuffer::Trim() const {
|
||||||
while (this->Count()) {
|
while (this->Count()) {
|
||||||
auto& data = const_cast<TSGrowableArray<uint32_t>&>(this->m_data);
|
auto& data = const_cast<TSGrowableArray<uint32_t>&>(this->m_data);
|
||||||
|
|
|
||||||
|
|
@ -18,6 +18,7 @@ class BigBuffer {
|
||||||
void GrowToFit(uint32_t index);
|
void GrowToFit(uint32_t index);
|
||||||
int32_t IsUsed(uint32_t index) const;
|
int32_t IsUsed(uint32_t index) const;
|
||||||
void SetCount(uint32_t count);
|
void SetCount(uint32_t count);
|
||||||
|
void SetOffset(uint32_t offset);
|
||||||
void Trim() const;
|
void Trim() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue