void *
memset (void *dst_, int value, size_t cnt)
{
- uint8_t *dst = dst_;
+ unsigned char *dst = dst_;
while (cnt-- > 0)
*dst++ = value;
void *
memcpy (void *dst_, const void *src_, size_t cnt)
{
- uint8_t *dst = dst_;
- const uint8_t *src = src_;
+ unsigned char *dst = dst_;
+ const unsigned char *src = src_;
while (cnt-- > 0)
*dst++ = *src++;
void *
memmove (void *dst_, const void *src_, size_t cnt)
{
- uint8_t *dst = dst_;
- const uint8_t *src = src_;
+ unsigned char *dst = dst_;
+ const unsigned char *src = src_;
if (dst < src)
{
void *
memchr (const void *block_, int ch_, size_t size)
{
- const uint8_t *block = block_;
- uint8_t ch = ch_;
+ const unsigned char *block = block_;
+ unsigned char ch = ch_;
for (; size-- > 0; block++)
if (*block == ch)
return NULL;
}
+int
+memcmp (const void *a_, const void *b_, size_t size)
+{
+ const unsigned char *a = a_;
+ const unsigned char *b = b_;
+
+ for (; size-- > 0; a++, b++)
+ if (*a != *b)
+ return *a > *b ? +1 : -1;
+ return 0;
+}
+
size_t
strlcpy (char *dst, const char *src, size_t size)
{
void *memcpy (void *, const void *, size_t);
void *memmove (void *, const void *, size_t);
void *memchr (const void *, int, size_t);
+int memcmp (const void *, const void *, size_t);
char *strchr (const char *, int);
size_t strlcpy (char *, const char *, size_t);