Добавление tool_strcpy

This commit is contained in:
Aren Elchinyan 2023-12-07 13:15:53 +03:00
parent ad38cbda6b
commit 4bcd50a63f
2 changed files with 10 additions and 0 deletions

View File

@ -42,6 +42,7 @@ static inline void pause( ) {
void tool_memcpy(void *dest, void *src, uint64_t n);
void *tool_memset(void *ptr, uint8_t n, uint64_t size);
uint64_t tool_strlen(const char *str);
void tool_strcpy(char *dest, char *src);
uint64_t tool_starts_with(const char *str, const char *prefix);
void tool_format(void (*putc)(char c), const char *format_string, va_list args);

View File

@ -32,6 +32,15 @@ uint64_t tool_strlen(const char *str) {
return length;
}
void tool_strcpy(char *dest, char *src) {
uint64_t i = 0;
while (src[i] != '\0') {
dest[i] = src[i];
i++;
}
dest[i] = '\0';
}
uint64_t tool_starts_with(const char *str, const char *prefix) {
uint64_t str_len = tool_strlen(str);
uint64_t prefix_len = tool_strlen(prefix);