diff options
author | Ian Moffett <ian@osmora.org> | 2024-03-07 17:28:00 -0500 |
---|---|---|
committer | Ian Moffett <ian@osmora.org> | 2024-03-07 17:28:32 -0500 |
commit | bd5969fc876a10b18613302db7087ef3c40f18e1 (patch) | |
tree | 7c2b8619afe902abf99570df2873fbdf40a4d1a1 /lib/mlibc/options/ansi/include/bits | |
parent | a95b38b1b92b172e6cc4e8e56a88a30cc65907b0 (diff) |
lib: Add mlibc
Signed-off-by: Ian Moffett <ian@osmora.org>
Diffstat (limited to 'lib/mlibc/options/ansi/include/bits')
-rw-r--r-- | lib/mlibc/options/ansi/include/bits/ansi/fenv.h | 54 | ||||
-rw-r--r-- | lib/mlibc/options/ansi/include/bits/ansi/time_t.h | 8 | ||||
-rw-r--r-- | lib/mlibc/options/ansi/include/bits/ansi/timespec.h | 13 |
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 + |