mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 03:28:20 +02:00
Optimizations, switching CanImplicitlyCast method, new CPU rate checker
This commit is contained in:
parent
39fd8d2624
commit
098ad1ce55
25 changed files with 759 additions and 301 deletions
|
@ -107,6 +107,42 @@ void ChunkedDataBuffer::Write(uint8 byte)
|
|||
mSize++;
|
||||
}
|
||||
|
||||
void ChunkedDataBuffer::Write_2(uint16 val)
|
||||
{
|
||||
while (mWriteCurPtr + 2 > mWriteCurAlloc + ALLOC_SIZE)
|
||||
{
|
||||
Write((uint8*)&val, 2);
|
||||
return;
|
||||
}
|
||||
*(uint16*)mWriteCurPtr = val;
|
||||
mWriteCurPtr += 2;
|
||||
mSize += 2;
|
||||
}
|
||||
|
||||
void ChunkedDataBuffer::Write_3(uint32 val)
|
||||
{
|
||||
while (mWriteCurPtr + 3 > mWriteCurAlloc + ALLOC_SIZE)
|
||||
{
|
||||
Write((uint8*)&val, 3);
|
||||
return;
|
||||
}
|
||||
*(uint32*)mWriteCurPtr = val;
|
||||
mWriteCurPtr += 3;
|
||||
mSize += 3;
|
||||
}
|
||||
|
||||
void ChunkedDataBuffer::Write_4(uint32 val)
|
||||
{
|
||||
while (mWriteCurPtr + 4 > mWriteCurAlloc + ALLOC_SIZE)
|
||||
{
|
||||
Write((uint8*)&val, 4);
|
||||
return;
|
||||
}
|
||||
*(uint32*)mWriteCurPtr = val;
|
||||
mWriteCurPtr += 4;
|
||||
mSize += 4;
|
||||
}
|
||||
|
||||
int ChunkedDataBuffer::GetReadPos()
|
||||
{
|
||||
return mReadPoolIdx * ALLOC_SIZE + (int)(mReadCurPtr - mReadCurAlloc);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue