summaryrefslogtreecommitdiff
path: root/na/include/libc-shim/stdint.h
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-04-21 23:16:50 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-04-21 23:16:50 +0800
commit5278f6def4248391a481382bd7b0042b04c829f2 (patch)
tree6b41347c2675dfda2da34c3aec6cea11ad033fe0 /na/include/libc-shim/stdint.h
parente7b6e9453800ecf15bee5f8f1763fd8c4862f70c (diff)
downloadlume-5278f6def4248391a481382bd7b0042b04c829f2.tar.gz
lume-5278f6def4248391a481382bd7b0042b04c829f2.tar.xz
feat: add string manipulation functions derived from musl libc
This commit introduces a variety of string manipulation functions, including: - `memmem`: Searches for a substring in a memory area. - `memmove`: Safely copies memory areas, handling overlaps. - `mempcpy`: Copies memory and returns a pointer to the end of the destination. - `memrchr`: Finds the last occurrence of a character in a memory area. - `memset`: Fills a memory area with a specified value. - `rindex`: Returns the last occurrence of a character in a string. - `stpcpy` and `stpncpy`: Copies strings and returns a pointer to the end. - `strcat`, `strchr`, `strcspn`, `strlcat`, `strlcpy`, `strlen`, `strncat`, `strncmp`, `strncpy`, `strnlen`, `strpbrk`, `strrchr`, `strstr`, `strtok`, and `strtok_r`: Various string manipulation functions for concatenation, searching, and tokenization. Assembly implementations for `memcpy`, `memmove`, and `memset` are also included for optimized performance on x86_64 architectures.
Diffstat (limited to 'na/include/libc-shim/stdint.h')
-rw-r--r--na/include/libc-shim/stdint.h21
1 files changed, 21 insertions, 0 deletions
diff --git a/na/include/libc-shim/stdint.h b/na/include/libc-shim/stdint.h
new file mode 100644
index 0000000..650bdcf
--- /dev/null
+++ b/na/include/libc-shim/stdint.h
@@ -0,0 +1,21 @@
+/* Shim: stdint types for musl string functions */
+#ifndef _STDINT_H
+#define _STDINT_H
+
+typedef unsigned char uint8_t;
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+typedef unsigned long uint64_t;
+typedef signed char int8_t;
+typedef signed short int16_t;
+typedef signed int int32_t;
+typedef signed long int64_t;
+typedef unsigned long uintptr_t;
+typedef long intptr_t;
+
+#define UINT8_MAX 0xFF
+#define UINT16_MAX 0xFFFF
+#define UINT32_MAX 0xFFFFFFFFU
+#define UINT64_MAX 0xFFFFFFFFFFFFFFFFUL
+
+#endif