Improve implementation of function VmaStringBuilder::AddNumber

This commit is contained in:
Adam Sawicki 2019-10-11 12:23:51 +02:00
parent 470399abf0
commit 6ac1d3a4b7

View File

@ -7054,15 +7054,29 @@ void VmaStringBuilder::Add(const char* pStr)
void VmaStringBuilder::AddNumber(uint32_t num)
{
char buf[11];
VmaUint32ToStr(buf, sizeof(buf), num);
Add(buf);
buf[10] = '\0';
char *p = &buf[10];
do
{
*--p = '0' + (num % 10);
num /= 10;
}
while(num);
Add(p);
}
void VmaStringBuilder::AddNumber(uint64_t num)
{
char buf[21];
VmaUint64ToStr(buf, sizeof(buf), num);
Add(buf);
buf[20] = '\0';
char *p = &buf[20];
do
{
*--p = '0' + (num % 10);
num /= 10;
}
while(num);
Add(p);
}
void VmaStringBuilder::AddPointer(const void* ptr)