diff options
Diffstat (limited to 'src/byte.c')
-rw-r--r-- | src/byte.c | 23 |
1 files changed, 16 insertions, 7 deletions
@@ -22,8 +22,11 @@ unsigned int byte_chr(char *s, unsigned int n, int c) return t - s; } -void byte_copy(char *to, unsigned int n, char *from) +void byte_copy(void *a, unsigned int n, const void *b) { + char *to = a; + const char *from = b; + for (;;) { // clang-format off if (!n) { return; } *to++ = *from++; --n; @@ -34,10 +37,10 @@ void byte_copy(char *to, unsigned int n, char *from) } } -void byte_copyr(char *to, unsigned int n, char *from) +void byte_copyr(void *a, unsigned int n, const void *b) { - to += n; - from += n; + char *to = a + n; + const char *from = b + n; for (;;) { // clang-format off @@ -49,8 +52,11 @@ void byte_copyr(char *to, unsigned int n, char *from) } } -int byte_diff(char *s, unsigned int n, char *t) +int byte_diff(const void *a, unsigned int n, const void *b) { + const char *s = a; + const char *t = b; + for (;;) { // clang-format off if (!n) { return 0; } if (*s != *t) { break; } ++s; ++t; --n; @@ -80,8 +86,10 @@ unsigned int byte_rchr(char *s, unsigned int n, int c) return u - s; } -void byte_zero(char *s, unsigned int n) +void byte_zero(void *v, unsigned int n) { + char *s = v; + for (;;) { // clang-format off if (!n) { break; } *s++ = 0; --n; @@ -92,8 +100,9 @@ void byte_zero(char *s, unsigned int n) } } -void byte_fill(char *s, unsigned int n, int c) +void byte_fill(void *a, unsigned int n, int c) { + char *s = a; char ch = c; for (;;) { |