luna/String.h: Convert to Types.h

This commit is contained in:
apio 2022-11-20 18:29:23 +01:00
parent 1f2901d41a
commit 459e1ed653
2 changed files with 12 additions and 12 deletions

View File

@ -2,19 +2,19 @@
extern "C"
{
void* memcpy(void* dest, const void* src, size_t n)
void* memcpy(void* dest, const void* src, usize n)
{
for (size_t i = 0; i < n; ++i) { *((u8*)dest + i) = *((const u8*)src + i); }
for (usize i = 0; i < n; ++i) { *((u8*)dest + i) = *((const u8*)src + i); }
return dest;
}
void* memset(void* buf, int c, size_t n)
void* memset(void* buf, int c, usize n)
{
for (size_t i = 0; i < n; ++i) { *((u8*)buf + i) = (u8)c; }
for (usize i = 0; i < n; ++i) { *((u8*)buf + i) = (u8)c; }
return buf;
}
int memcmp(const void* a, const void* b, size_t n)
int memcmp(const void* a, const void* b, usize n)
{
if (!n) return 0;
const u8* ap = (const u8*)a;
@ -27,7 +27,7 @@ extern "C"
return *ap - *bp;
}
void* memmove(void* dest, const void* src, size_t n)
void* memmove(void* dest, const void* src, usize n)
{
if (dest == src) return dest;
if (dest > src)
@ -37,7 +37,7 @@ extern "C"
return dest;
}
size_t strlen(const char* str)
usize strlen(const char* str)
{
const char* i = str;
for (; *i; ++i)

View File

@ -3,9 +3,9 @@
extern "C"
{
void* memcpy(void* dest, const void* src, size_t n);
void* memset(void* buf, int c, size_t n);
int memcmp(const void* a, const void* b, size_t n);
void* memmove(void* dest, const void* src, size_t n);
size_t strlen(const char* str);
void* memcpy(void* dest, const void* src, usize n);
void* memset(void* buf, int c, usize n);
int memcmp(const void* a, const void* b, usize n);
void* memmove(void* dest, const void* src, usize n);
usize strlen(const char* str);
}