summaryrefslogtreecommitdiff
path: root/include/arch/x86_64/asm/fpmath.h
diff options
context:
space:
mode:
authorKacper <kacper@mail.openlinux.dev>2025-12-07 20:10:31 +0100
committerKacper <kacper@mail.openlinux.dev>2025-12-07 20:10:31 +0100
commitfc00c656c96528112d05cf0edf8631bd5eaea446 (patch)
treea6e0e6c588191a8bd1c64afc3b7a258e3e66c236 /include/arch/x86_64/asm/fpmath.h
Add build system scaffolding and libc headers
Diffstat (limited to 'include/arch/x86_64/asm/fpmath.h')
-rw-r--r--include/arch/x86_64/asm/fpmath.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/include/arch/x86_64/asm/fpmath.h b/include/arch/x86_64/asm/fpmath.h
new file mode 100644
index 00000000..43ee6cfb
--- /dev/null
+++ b/include/arch/x86_64/asm/fpmath.h
@@ -0,0 +1,33 @@
+#ifndef __ASM_FPMATH_H
+#define __ASM_FPMATH_H
+
+union l2bits {
+ long double e;
+ struct {
+ unsigned int manl : 32;
+ unsigned int manh : 32;
+ unsigned int exp : 15;
+ unsigned int sign : 1;
+ unsigned int junkl : 16;
+ unsigned int junkh : 32;
+ } bits;
+ struct {
+ unsigned long man : 64;
+ unsigned int expsign : 16;
+ unsigned long junk : 48;
+ } xbits;
+};
+
+#define LDBL_NBIT 0x80000000
+#define mask_nbit_l(u) ((u).bits.manh &= ~LDBL_NBIT)
+
+#define LDBL_MANH_SIZE 32
+#define LDBL_MANL_SIZE 32
+
+#define LDBL_TO_ARRAY32(u, a) \
+ do { \
+ (a)[0] = (uint32_t)(u).bits.manl; \
+ (a)[1] = (uint32_t)(u).bits.manh; \
+ } while (0)
+
+#endif