summaryrefslogblamecommitdiff
path: root/src/stem/lib/stdlib.c
blob: 904126efe42365591b46fe8a73309e6bddaf6a37 (plain) (tree)






























                                                            
#include "stdlib.h"

void *memcpy(void *dest, const void *src, int count) {
	int i;
	uint8_t *d = (uint8_t*)dest, *s = (uint8_t*)src;
	for (i = 0; i < count; i++) {
		d[i] = s[i];
	}
	return dest;
}

uint8_t *memset(uint8_t *dest, uint8_t val, int count) {
	int i;
	for (i = 0; i < count; i++) {
		dest[i] = val;
	}
}

uint16_t *memsetw(uint16_t *dest, uint16_t val, int count) {
	int i;
	for (i = 0; i < count; i++) {
		dest[i] = val;
	}
	return dest;
}

int strlen(const char *str) {
	int i = 0;
	while (str[i++]);
	return i;
}