Merge pull request #7520 from Robyt3/Packer-Improvements

Minor improvements to `CPacker` and `CUnpacker`
This commit is contained in:
heinrich5991 2023-11-22 16:44:30 +00:00 committed by GitHub
commit f95b0f163f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -72,12 +72,8 @@ void CPacker::AddRaw(const void *pData, int Size)
return;
}
const unsigned char *pSrc = (const unsigned char *)pData;
while(Size)
{
*m_pCurrent++ = *pSrc++;
Size--;
}
mem_copy(m_pCurrent, pData, Size);
m_pCurrent += Size;
}
void CUnpacker::Reset(const void *pData, int Size)
@ -134,7 +130,8 @@ int CUnpacker::GetUncompressedInt()
return 0;
}
int i = *(int *)m_pCurrent;
int i;
mem_copy(&i, m_pCurrent, sizeof(int));
m_pCurrent += sizeof(int);
return i;
}