summaryrefslogtreecommitdiff
path: root/src/stem/lib/stdlib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/stem/lib/stdlib.c')
-rw-r--r--src/stem/lib/stdlib.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/src/stem/lib/stdlib.c b/src/stem/lib/stdlib.c
new file mode 100644
index 0000000..904126e
--- /dev/null
+++ b/src/stem/lib/stdlib.c
@@ -0,0 +1,31 @@
+#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;
+}