summaryrefslogtreecommitdiff
path: root/include/stdint.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/stdint.h')
-rw-r--r--include/stdint.h71
1 files changed, 71 insertions, 0 deletions
diff --git a/include/stdint.h b/include/stdint.h
new file mode 100644
index 0000000..c2328f8
--- /dev/null
+++ b/include/stdint.h
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2025 Danny Holman <dholman@gymli.org>
+ *
+ * This file is part of BoxOS, a free and open-source Unix-like operating
+ * system.
+ *
+ * BoxOS is free software; you can redistribute it and/or modify under the
+ * terms of the GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the License, or (at your option) any later
+ * version.
+ *
+ * BoxOS is distributed in the hope it will be useful, but WITHOUT ANY WARRANTY;
+ * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along with
+ * BoxOS; if not, see <https://www.gnu.org/licenses/>.
+ */
+
+#ifndef STDINT_H
+#define STDINT_H
+
+typedef unsigned char __u_char;
+typedef unsigned short __u_short;
+typedef unsigned int __u_int;
+
+typedef signed char __int8_t;
+typedef signed short int __int16_t;
+typedef signed int __int32_t;
+
+typedef __u_char __uint8_t;
+typedef __u_short __uint16_t;
+typedef __u_int __uint32_t;
+
+#if defined(__x86_64__) || defined(__aarch64__) || defined(__zarch__) || __riscv_xlen == 64
+typedef unsigned long long __u_long;
+typedef signed long long __int64_t;
+typedef __u_long __uint64_t;
+typedef __int64_t intptr_t;
+typedef __uint64_t uintptr_t;
+#elif defined(__i386__) || defined(__arm__) || __riscv_xlen == 32
+typedef unsigned long __u_long;
+typedef signed long __int64_t;
+typedef __u_long __uint64_t;
+typedef __int32_t intptr_t;
+typedef __uint32_t uintptr_t;
+#else
+#error "Unsupported architecture"
+#endif
+
+typedef __int8_t __int_least8_t;
+typedef __int16_t __int_least16_t;
+typedef __int32_t __int_least32_t;
+typedef __int64_t __int_least64_t;
+
+typedef __uint8_t __uint_least8_t;
+typedef __uint16_t __uint_least16_t;
+typedef __uint32_t __uint_least32_t;
+typedef __uint64_t __uint_least64_t;
+
+typedef __int_least8_t int8_t;
+typedef __int_least16_t int16_t;
+typedef __int_least32_t int32_t;
+typedef __int_least64_t int64_t;
+
+typedef __uint_least8_t uint8_t;
+typedef __uint_least16_t uint16_t;
+typedef __uint_least32_t uint32_t;
+typedef __uint_least64_t uint64_t;
+
+#endif