target/cris: Populate CPUClass.mmu_index
[qemu/ar7.git] / pc-bios / vof / libc.c
blobfdbc30f777d460f9dad8ae12d1c1e37dcf22d243
1 #include "vof.h"
3 int strlen(const char *s)
5 int len = 0;
7 while (*s != 0) {
8 len += 1;
9 s += 1;
12 return len;
15 int strcmp(const char *s1, const char *s2)
17 while (*s1 != 0 && *s2 != 0) {
18 if (*s1 != *s2) {
19 break;
21 s1 += 1;
22 s2 += 1;
25 return *s1 - *s2;
28 void *memcpy(void *dest, const void *src, size_t n)
30 char *cdest;
31 const char *csrc = src;
33 cdest = dest;
34 while (n-- > 0) {
35 *cdest++ = *csrc++;
38 return dest;
41 int memcmp(const void *ptr1, const void *ptr2, size_t n)
43 const unsigned char *p1 = ptr1;
44 const unsigned char *p2 = ptr2;
46 while (n-- > 0) {
47 if (*p1 != *p2) {
48 return *p1 - *p2;
50 p1 += 1;
51 p2 += 1;
54 return 0;
57 void *memset(void *dest, int c, size_t size)
59 unsigned char *d = (unsigned char *)dest;
61 while (size-- > 0) {
62 *d++ = (unsigned char)c;
65 return dest;