summaryrefslogtreecommitdiffstatshomepage
path: root/lib/libc/string0.c
diff options
context:
space:
mode:
authorDamien George <damien.p.george@gmail.com>2015-04-18 14:27:55 +0100
committerDamien George <damien.p.george@gmail.com>2015-04-18 14:27:55 +0100
commitf53a8e712f6b38f15be81cb692c03c1afacce7ae (patch)
treefdeab9268e61c82c233b3c5303b56de1d3b50ca6 /lib/libc/string0.c
parent1c9a499135a03a7eabc66e9d3571508fe074e859 (diff)
downloadmicropython-f53a8e712f6b38f15be81cb692c03c1afacce7ae.tar.gz
micropython-f53a8e712f6b38f15be81cb692c03c1afacce7ae.zip
lib/libc/string0.c: Remove include of std.h, replace with string.h.
Much more portable this way.
Diffstat (limited to 'lib/libc/string0.c')
-rw-r--r--lib/libc/string0.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/libc/string0.c b/lib/libc/string0.c
index b73a5e9ea9..136c1b49cc 100644
--- a/lib/libc/string0.c
+++ b/lib/libc/string0.c
@@ -25,7 +25,7 @@
*/
#include <stdint.h>
-#include "std.h"
+#include <string.h>
#define likely(x) __builtin_expect((x), 1)
@@ -102,10 +102,12 @@ void *memset(void *s, int c, size_t n) {
return s;
}
-int memcmp(const char *s1, const char *s2, size_t n) {
+int memcmp(const void *s1, const void *s2, size_t n) {
+ const uint8_t *s1_8 = s1;
+ const uint8_t *s2_8 = s2;
while (n--) {
- char c1 = *s1++;
- char c2 = *s2++;
+ char c1 = *s1_8++;
+ char c2 = *s2_8++;
if (c1 < c2) return -1;
else if (c1 > c2) return 1;
}