about summary refs log tree commit diff stats
path: root/src/include
diff options
context:
space:
mode:
authorptitSeb <sebastien.chev@gmail.com>2023-04-06 10:56:02 +0200
committerptitSeb <sebastien.chev@gmail.com>2023-04-06 10:56:02 +0200
commit307a019cb8e92051fe8fda897a784bba30284e6e (patch)
treedc2a20644f3eec8dbdd4a2fedd17e1ecf98f4627 /src/include
parent4ca16188c215cdbb001f0ed2794c50d812197673 (diff)
downloadbox64-307a019cb8e92051fe8fda897a784bba30284e6e.tar.gz
box64-307a019cb8e92051fe8fda897a784bba30284e6e.zip
Try to add complex function in libm
Diffstat (limited to 'src/include')
-rw-r--r--src/include/complext.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/include/complext.h b/src/include/complext.h
new file mode 100644
index 00000000..3893268d
--- /dev/null
+++ b/src/include/complext.h
@@ -0,0 +1,33 @@
+#ifndef __COMPLEX_T__H_
+#define __COMPLEX_T__H_
+
+typedef struct complex_s { double r; double i;} complex_t;
+typedef struct complexf_s { float r; float i;} complexf_t;
+
+#endif //__COMPLEX_T__H_
+
+#ifdef COMPLEX_IMPL
+#ifndef __COMPLEX_T_IMPL_H_
+#define __COMPLEX_T_IMPL_H_
+inline complexf_t to_complexf(x64emu_t* emu, int i) {
+    complexf_t ret; 
+    ret.r = emu->xmm[i].f[0];
+    ret.i = emu->xmm[i+1].f[0];
+    return ret;
+}
+inline complex_t to_complex(x64emu_t* emu, int i) {
+    complex_t ret;
+    ret.r = emu->xmm[i].d[0];
+    ret.i = emu->xmm[i+1].d[0];
+    return ret;
+}
+inline void from_complexf(x64emu_t* emu, complexf_t v) {
+    emu->xmm[0].f[0]=v.r;
+    emu->xmm[0].f[1]=v.i;
+}
+inline void from_complex(x64emu_t* emu, complex_t v) {
+    emu->xmm[0].d[0]=v.r; 
+    emu->xmm[1].d[0]=v.i;
+}
+#endif // __COMPLEX_T_IMPL_H_
+#endif  // COMPLEX_IMPL