summaryrefslogtreecommitdiff
path: root/src/common/include
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/include')
-rw-r--r--src/common/include/stdlib.h14
-rw-r--r--src/common/include/string.h14
-rw-r--r--src/common/include/types.h17
3 files changed, 45 insertions, 0 deletions
diff --git a/src/common/include/stdlib.h b/src/common/include/stdlib.h
new file mode 100644
index 0000000..2c5e6dd
--- /dev/null
+++ b/src/common/include/stdlib.h
@@ -0,0 +1,14 @@
+#ifndef _DEF_STDLIB_H
+#define _DEF_STDLIB_H
+
+#include <types.h>
+
+#define MIN(a, b) ((a) < (b) ? (a) : (b))
+#define MAX(a, b) ((a) > (b) ? (a) : (b))
+
+void *memcpy(void *dest, const void *src, int count);
+uint8_t *memset(uint8_t *dest, uint8_t val, int count);
+uint16_t *memsetw(uint16_t *dest, uint16_t val, int count);
+
+#endif
+
diff --git a/src/common/include/string.h b/src/common/include/string.h
new file mode 100644
index 0000000..a41459e
--- /dev/null
+++ b/src/common/include/string.h
@@ -0,0 +1,14 @@
+#ifndef _DEF_STRING_H
+#define _DEF_STRING_H
+
+// #include <stdlib.h>
+#include <types.h>
+
+int strlen(const char *str);
+char *strcpy(char *dest, const char *src);
+// char *strdup(const char *src); // uses malloc, that's bad
+char *strchr(const char *str, char c);
+char *strcat(char *dest, const char *src);
+int strcmp(const char *s1, const char *s2);
+
+#endif
diff --git a/src/common/include/types.h b/src/common/include/types.h
new file mode 100644
index 0000000..ec24ce5
--- /dev/null
+++ b/src/common/include/types.h
@@ -0,0 +1,17 @@
+#ifndef DEF_TYPES_H
+#define DEF_TYPES_H
+
+typedef unsigned long long uint64_t;
+typedef unsigned int uint32_t;
+typedef unsigned short uint16_t;
+typedef unsigned char uint8_t;
+typedef long long int64_t;
+typedef int int32_t;
+typedef short int16_t;
+typedef char int8_t;
+
+typedef unsigned int size_t;
+
+#define NULL 0
+
+#endif