diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-02-09 15:19:05 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-02-09 15:19:05 +0100 |
| commit | 5a203222516ad0306211df599dcabdb397509bf9 (patch) | |
| tree | 22880a9be60009378a13bcaf7b17d59a40f45fa1 /src/include | |
| parent | 89b5e1163dc79b33f978d37a51976ec5118165c4 (diff) | |
| download | box64-5a203222516ad0306211df599dcabdb397509bf9.tar.gz box64-5a203222516ad0306211df599dcabdb397509bf9.zip | |
[WRAPPING] Added supot for the 'long double complex' type
Diffstat (limited to 'src/include')
| -rw-r--r-- | src/include/complext.h | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/include/complext.h b/src/include/complext.h index 60d22156..695bb876 100644 --- a/src/include/complext.h +++ b/src/include/complext.h @@ -3,10 +3,14 @@ typedef struct complex_s { double r; double i;} complex_t; typedef struct complexf_s { float r; float i;} complexf_t; +typedef struct complexl_s { long double r; long double i;} complexl_t; + #endif //__COMPLEX_T__H_ #ifdef COMPLEX_IMPL +#include "emu/x87emu_private.h" +#include "x64emu.h" #ifndef __COMPLEX_T_IMPL_H_ #define __COMPLEX_T_IMPL_H_ static inline complexf_t to_complexf(x64emu_t* emu, int i) { @@ -21,6 +25,18 @@ static inline complex_t to_complex(x64emu_t* emu, int i) { ret.i = emu->xmm[i+1].d[0]; return ret; } +static inline complexl_t to_complexl(x64emu_t* emu, uintptr_t p) { + complexl_t ret; + ret.r = *(long double*)p; + ret.i = *(long double*)(p+16); + return ret; +} +static inline complex_t to_complexk(x64emu_t* emu, uintptr_t p) { + complex_t ret; + ret.r = FromLD((long double*)p); + ret.i = FromLD((long double*)(p+16)); + return ret; +} static inline void from_complexf(x64emu_t* emu, complexf_t v) { emu->xmm[0].f[0]=v.r; emu->xmm[0].f[1]=v.i; @@ -29,5 +45,17 @@ static inline void from_complex(x64emu_t* emu, complex_t v) { emu->xmm[0].d[0]=v.r; emu->xmm[1].d[0]=v.i; } +static inline void from_complexl(x64emu_t* emu, complexl_t v) { + fpu_do_push(emu); + fpu_do_push(emu); + ST0.d=FromLD(&v.r); + ST(1).d=FromLD(&v.i); +} +static inline void from_complexk(x64emu_t* emu, complex_t v) { + fpu_do_push(emu); + fpu_do_push(emu); + ST0.d=v.r; + ST1.d=v.i; +} #endif // __COMPLEX_T_IMPL_H_ #endif // COMPLEX_IMPL |