forked from Lephenixnoir/gint
Lephe
9d1187b5b4
This change adds optimized versions of the core memory functions, relying on 4-alignment, 2-alignment, and the SH4's unaligned move instruction to (hopefully) attain good performance in all situations.
35 lines
1 KiB
C
35 lines
1 KiB
C
//---
|
|
// gint:std:string - a few <string.h> functions provided by gint
|
|
//---
|
|
|
|
#ifndef GINT_STD_STRING
|
|
#define GINT_STD_STRING
|
|
|
|
#include <stddef.h>
|
|
|
|
/* memcpy(): Copy a chunk of memory to a non-overlapping destination */
|
|
void *memcpy(void * restrict dest, void const * restrict src, size_t n);
|
|
|
|
/* memset(): Fill a chunk of memory with a single byte */
|
|
void *memset(void *dest, int byte, size_t n);
|
|
|
|
/* memcpy(): Compare two chunks of memory */
|
|
int memcmp(void const *s1, void const *s2, size_t n);
|
|
|
|
/* memmove(): Copy a chunk of memory to a possibly overlapping destination */
|
|
void *memmove(void *dest, void const *src, size_t n);
|
|
|
|
/* strlen(): Length of a NUL-terminated string */
|
|
size_t strlen(char const *str);
|
|
|
|
/* strncpy(): Copy a string with a size limit */
|
|
char *strncpy(char *dst, char const *src, size_t n);
|
|
|
|
/* strcat(): Concatenation a string to a pre-allocated space */
|
|
char *strcat(char *dest, const char *src);
|
|
|
|
/* strcmp(): Compare NUL-terminated strings */
|
|
int strcmp(char const *s1, char const *s2);
|
|
|
|
#endif /* GINT_STD_STRING */
|