Commit bc5b3f8c authored by Paul Sokolovsky's avatar Paul Sokolovsky
Browse files

stm: Add memcmp() implementation.

parent 1eacefe5
......@@ -34,6 +34,16 @@ void *memset(void *s, int c, size_t n) {
return s;
}
int memcmp(const char *s1, const char *s2, size_t n) {
while (n--) {
char c1 = *s1++;
char c2 = *s2++;
if (c1 < c2) return -1;
else if (c1 > c2) return 1;
}
return 0;
}
size_t strlen(const char *str) {
int len = 0;
for (const char *s = str; *s; s++) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment