Hey guys I know little of C (specializing in JAVA) and my data structures course asked that I transfer this into MIPS using $a and $v registers... any help would be awesome!
#include <stdlib.h>
void *(memset)(void *s, int c, size_t n) {
const unsigned char uc = c;
unsigned char *su;
for (su = s; 0 < n; ++su, --n) {
*su = uc;
}
return s;
}
void *(a_memmove)(void *dest, const void *src, size_t n) {
char *sc1;
const char *sc2;
sc1 = dest;
sc2 = src;
if (sc2 < sc1 && sc1 < sc2 + n) {
for (sc1 += n, sc2 += n; 0 < n; --n) {
*--sc1 = *--sc2;
}
} else {
for (; 0 < n; --n) {
*sc1++ = *sc2++;
}
}
return (dest);
}
char *(a_strcat)(char *dest, const char *src, size_t n) {
char *s;
for (s = dest; *s != '\0'; ++s)
;
for (; 0 < n && *src != '\0'; --n) {
*s++ = *src++;
}
*s = '\0';
return (dest);
}