summaryrefslogtreecommitdiffstats
path: root/sw/z80/libc
diff options
context:
space:
mode:
authorNao Pross <naopross@thearcway.org>2017-08-25 10:26:21 +0200
committerNao Pross <naopross@thearcway.org>2017-08-25 10:26:21 +0200
commitf209dc3a24987419c3f7ad9fbe3fe2b4dfb16427 (patch)
treeb2a9a38bd081756c70917a64e1c830489939f4ca /sw/z80/libc
parentnew programmer interface for linux (diff)
downloadz80uPC-f209dc3a24987419c3f7ad9fbe3fe2b4dfb16427.tar.gz
z80uPC-f209dc3a24987419c3f7ad9fbe3fe2b4dfb16427.zip
implements pio.h functions and makefile update to optimize size
- remove syscall.h, unused and not implemented - bug fix for memcmp() in string.c other changes are still partially unfinished and might not work
Diffstat (limited to 'sw/z80/libc')
-rw-r--r--sw/z80/libc/string.c20
1 files changed, 9 insertions, 11 deletions
diff --git a/sw/z80/libc/string.c b/sw/z80/libc/string.c
index 9dd56cc..57b3a7f 100644
--- a/sw/z80/libc/string.c
+++ b/sw/z80/libc/string.c
@@ -1,11 +1,11 @@
#include "string.h"
-void * memset(void *dest, const int8_t src, size_t n) {
+void *memset(void *dest, const int8_t src, size_t n) {
- void *dp = dest;
+ char *dp = (char *) dest;
while (n--)
- *dp++ = src;
+ *(dp++) = src;
return dest;
}
@@ -22,16 +22,14 @@ void *memcpy(void *dest, void *src, size_t n)
return dest;
}
-int8_t memcmp(const void *s1, const void *s2, size_t n) {
-
- uint8_t u1, u2;
-
- for ( ; n--; s1++, s2++) {
+int8_t memcmp(void *s1, void *s2, size_t n)
+{
+ char *u1 = (char *) s1;
+ char *u2 = (char *) s2;
- u1 = *s1;
- u2 = *s2;
+ for ( ; n--; u1++, u2++) {
- if (u1 != u2)
+ if (*u1 != *u2)
return u1 - u2;
}