summaryrefslogtreecommitdiff
path: root/include/limits.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/limits.h')
-rw-r--r--include/limits.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/include/limits.h b/include/limits.h
new file mode 100644
index 0000000..6ee065d
--- /dev/null
+++ b/include/limits.h
@@ -0,0 +1,83 @@
+/*
+ * 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 LIMITS_H
+#define LIMITS_H
+
+#define CHAR_BIT 8
+#define SCHAR_MIN (-128)
+#define SCHAR_MAX 127
+#define UCHAR_MAX 255
+
+#define CHAR_MIN SCHAR_MIN
+#define CHAR_MAX SCHAR_MAX
+
+#define SHRT_MIN (-32768)
+#define SHRT_MAX 32767
+#define USHRT_MAX 65535
+
+#define INT_MIN (-2147483648)
+#define INT_MAX 2147483647
+#define UINT_MAX 4294967295U
+
+#define LONG_MIN (-9223372036854775808L)
+#define LONG_MAX 9223372036854775807L
+#define ULONG_MAX 18446744073709551615UL
+
+#define FLT_RADIX 2
+#define FLT_MANT_DIG 24
+#define FLT_DIG 6
+#define FLT_MIN 1.175494351e-38F
+#define FLT_MAX 3.402823466e+38F
+
+#define DBL_MANT_DIG 53
+#define DBL_DIG 15
+#define DBL_MIN 2.2250738585072014e-308
+#define DBL_MAX 1.7976931348623157e+308
+
+#define INT8_MIN (-1-0x7F)
+#define INT16_MIN (-1-0x7FFF)
+#define INT32_MIN (-1-0x7FFFFFFF)
+#define INT64_MIN (-1-0x7FFFFFFFFFFFFFFF)
+
+#define INT8_MAX (0x7F)
+#define INT16_MAX (0x7FFF)
+#define INT32_MAX (0x7FFFFFFF)
+#define INT64_MAX (0x7FFFFFFFFFFFFFFF)
+
+#define UINT8_MAX (0xFF)
+#define UINT16_MAX (0xFFFF)
+#define UINT32_MAX (0xFFFFFFFF)
+#define UINT64_MAX (0xFFFFFFFFFFFFFFFF)
+
+#define INTPTR_MAX INT64_MAX
+#define UINTPTR_MAX UINT64_MAX
+
+#define INT_FAST8_MIN INT8_MIN
+#define INT_FAST64_MIN INT64_MIN
+
+#define INT_FAST8_MAX INT8_MAX
+#define INT_FAST64_MAX INT64_MAX
+
+#define INT_LEAST8_MIN INT8_MIN
+#define INT_LEAST16_MIN INT16_MIN
+#define INT_LEAST32_MIN INT32_MIN
+#define INT_LEAST64_MIN INT64_MIN
+
+#endif