PowerPC recompiler rework (#641)

This commit is contained in:
Exzap 2025-04-26 17:59:32 +02:00 committed by GitHub
parent 06233e3462
commit b089ae5b32
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
54 changed files with 15433 additions and 12397 deletions

View file

@ -44,10 +44,9 @@ public:
void add(std::string_view appendedStr)
{
size_t remainingLen = this->limit - this->length;
size_t copyLen = appendedStr.size();
if (remainingLen < copyLen)
copyLen = remainingLen;
if (this->length + copyLen + 1 >= this->limit)
_reserve(std::max<uint32>(this->length + copyLen + 64, this->limit + this->limit / 2));
char* outputStart = (char*)(this->str + this->length);
std::copy(appendedStr.data(), appendedStr.data() + copyLen, outputStart);
length += copyLen;
@ -80,6 +79,13 @@ public:
}
private:
void _reserve(uint32 newLimit)
{
cemu_assert_debug(newLimit > length);
this->str = (uint8*)realloc(this->str, newLimit + 4);
this->limit = newLimit;
}
uint8* str;
uint32 length; /* in bytes */
uint32 limit; /* in bytes */