summaryrefslogtreecommitdiff
path: root/include/common.h
diff options
context:
space:
mode:
authorNathan Lee <me@nwlee.tech>2026-08-12 17:44:17 -0500
committerNathan Lee <me@nwlee.tech>2026-08-12 17:44:17 -0500
commit2c0efd93530c472e96ff3529aee983b53f3b78d9 (patch)
treecc36e7334e162ba67df79333e267ac93b4d984b9 /include/common.h
parent640a81b3ee366c651286efd1b80b37992cd53282 (diff)
rework project structure
Diffstat (limited to 'include/common.h')
-rw-r--r--include/common.h39
1 files changed, 0 insertions, 39 deletions
diff --git a/include/common.h b/include/common.h
deleted file mode 100644
index d26b8ae..0000000
--- a/include/common.h
+++ /dev/null
@@ -1,39 +0,0 @@
-#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;
-}
-
-static inline int memcmp(const void *s1, const void *s2, size_t n) {
- const unsigned char *p1 = (const unsigned char *)s1;
- const unsigned char *p2 = (const unsigned char *)s2;
-
- for (size_t i = 0; i < n; i++) {
- if (p1[i] != p2[i]) {
- return p1[i] - p2[i];
- }
- }
-
- return 0;
-}
-
-static inline void *memcpy(void *restrict dest, const void* restrict src, size_t size) {
- unsigned char *d = (unsigned char *)dest;
- unsigned char *s = (unsigned char *)src;
- for (size_t i = 0; i < size; i++) {
- d[i] = s[i];
- }
- return d;
-}