summaryrefslogtreecommitdiff
path: root/include/common.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/common.h')
-rw-r--r--include/common.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h
new file mode 100644
index 0000000..86f1f9c
--- /dev/null
+++ b/include/common.h
@@ -0,0 +1,19 @@
+#pragma once
+#include <types.h>
+
+static inline size_t strlen(const char *s) {
+ size_t len = 0;
+ while (*s++) {
+ ++len;
+ }
+ return len;
+}
+static inline int strcmp(const char *str1, const char* str2) {
+ while (*str1 && (*str1 == *str2)) {
+ ++str1;
+ ++str2;
+ }
+ return *(const unsigned char *)str1 - *(const unsigned char *)str2;
+}
+
+