diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2023-04-06 10:56:02 +0200 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2023-04-06 10:56:02 +0200 |
| commit | 307a019cb8e92051fe8fda897a784bba30284e6e (patch) | |
| tree | dc2a20644f3eec8dbdd4a2fedd17e1ecf98f4627 /src/include/complext.h | |
| parent | 4ca16188c215cdbb001f0ed2794c50d812197673 (diff) | |
| download | box64-307a019cb8e92051fe8fda897a784bba30284e6e.tar.gz box64-307a019cb8e92051fe8fda897a784bba30284e6e.zip | |
Try to add complex function in libm
Diffstat (limited to 'src/include/complext.h')
| -rw-r--r-- | src/include/complext.h | 33 |
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 |