In C++, I have made a basic memset / memcpy / strcpy implementation, yet I am worried that they are slower than the STL equivalent, as they are probably made in assembly, which I do not know. Is there any way of making these quicker, still using C++?
#define BYTE unsigned char
typedef BYTE byte;
void *__memset(void *_Dst, int _Val, UINT _Size)
{
BYTE *buf = (BYTE *)_Dst;
while (_Size--)
{
*buf++ = (BYTE)_Val;
}
return _Dst;
}
void *__memcpy(void *_Dst, const void *_Src, UINT _Size)
{
BYTE *buf = (BYTE *)_Dst;
BYTE *__Src = (BYTE *)_Src;
while (_Size--)
{
*buf++ = *__Src++;
}
return _Dst;
}
char *__strcpy(char *_Dst, const char *_Src)
{
while ((*_Dst++ = *_Src++) != '\0');
return _Dst;
}