aboutsummaryrefslogtreecommitdiff
path: root/lib/mlibc/options/ansi/include/bits
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mlibc/options/ansi/include/bits')
-rw-r--r--lib/mlibc/options/ansi/include/bits/ansi/fenv.h54
-rw-r--r--lib/mlibc/options/ansi/include/bits/ansi/time_t.h8
-rw-r--r--lib/mlibc/options/ansi/include/bits/ansi/timespec.h13
3 files changed, 75 insertions, 0 deletions
diff --git a/lib/mlibc/options/ansi/include/bits/ansi/fenv.h b/lib/mlibc/options/ansi/include/bits/ansi/fenv.h
new file mode 100644
index 0000000..677ddaa
--- /dev/null
+++ b/lib/mlibc/options/ansi/include/bits/ansi/fenv.h
@@ -0,0 +1,54 @@
+#ifndef MLIBC_FENV_H
+#define MLIBC_FENV_H
+
+#if defined(__x86_64__) || defined(__i386__)
+
+#define FE_DENORMAL 2
+#define FE_DIVBYZERO 4
+#define FE_INEXACT 32
+#define FE_INVALID 1
+#define FE_OVERFLOW 8
+#define FE_UNDERFLOW 16
+
+#define FE_ALL_EXCEPT (FE_DENORMAL | FE_DIVBYZERO | FE_INEXACT | FE_INVALID | FE_OVERFLOW | FE_UNDERFLOW)
+
+#define FE_TONEAREST 0
+#define FE_DOWNWARD 0x400
+#define FE_UPWARD 0x800
+#define FE_TOWARDZERO 0xC00
+
+#elif defined(__aarch64__)
+
+#define FE_INVALID 1
+#define FE_DIVBYZERO 2
+#define FE_OVERFLOW 4
+#define FE_UNDERFLOW 8
+#define FE_INEXACT 16
+
+#define FE_ALL_EXCEPT 31
+
+#define FE_TONEAREST 0
+#define FE_UPWARD 0x400000
+#define FE_DOWNWARD 0x800000
+#define FE_TOWARDZERO 0xC00000
+
+#elif defined(__riscv) && __riscv_xlen == 64
+
+#define FE_INEXACT 1
+#define FE_UNDERFLOW 2
+#define FE_OVERFLOW 4
+#define FE_DIVBYZERO 8
+#define FE_INVALID 16
+
+#define FE_ALL_EXCEPT 31
+
+#define FE_TONEAREST 0
+#define FE_TOWARDZERO 1
+#define FE_DOWNWARD 2
+#define FE_UPWARD 3
+
+#else
+#error Unknown architecture
+#endif
+
+#endif // MLIBC_FENV_H
diff --git a/lib/mlibc/options/ansi/include/bits/ansi/time_t.h b/lib/mlibc/options/ansi/include/bits/ansi/time_t.h
new file mode 100644
index 0000000..1c29fa0
--- /dev/null
+++ b/lib/mlibc/options/ansi/include/bits/ansi/time_t.h
@@ -0,0 +1,8 @@
+
+#ifndef MLIBC_TIME_T
+#define MLIBC_TIME_T
+
+typedef long time_t;
+
+#endif
+
diff --git a/lib/mlibc/options/ansi/include/bits/ansi/timespec.h b/lib/mlibc/options/ansi/include/bits/ansi/timespec.h
new file mode 100644
index 0000000..d34aa64
--- /dev/null
+++ b/lib/mlibc/options/ansi/include/bits/ansi/timespec.h
@@ -0,0 +1,13 @@
+
+#ifndef MLIBC_TIMESPEC_H
+#define MLIBC_TIMESPEC_H
+
+#include <bits/ansi/time_t.h>
+
+struct timespec {
+ time_t tv_sec;
+ long tv_nsec;
+};
+
+#endif // MLIBC_TIMESPEC_H
+