diff options
| author | ptitSeb <sebastien.chev@gmail.com> | 2024-11-18 11:07:44 +0100 |
|---|---|---|
| committer | ptitSeb <sebastien.chev@gmail.com> | 2024-11-18 11:07:44 +0100 |
| commit | 4257fdded3b89b739fe4ee8a56593494c5a69720 (patch) | |
| tree | cdd7764438ca6286db763622489bce2407f15cbb /src/libtools | |
| parent | 56298870f68294b76ef963dd2ea0864789b811c3 (diff) | |
| download | box64-4257fdded3b89b739fe4ee8a56593494c5a69720.tar.gz box64-4257fdded3b89b739fe4ee8a56593494c5a69720.zip | |
[BOX32] Fixed long double handling on printf like functions
Diffstat (limited to 'src/libtools')
| -rwxr-xr-x | src/libtools/myalign32.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/libtools/myalign32.c b/src/libtools/myalign32.c index f38776b6..8776731f 100755 --- a/src/libtools/myalign32.c +++ b/src/libtools/myalign32.c @@ -21,6 +21,7 @@ void myStackAlign32(const char* fmt, uint32_t* st, uint64_t* mystack) const char* p = fmt; int state = 0; double d; + long double ld; while(*p) { switch(state) { @@ -109,7 +110,10 @@ void myStackAlign32(const char* fmt, uint32_t* st, uint64_t* mystack) st+=3; mystack+=2; #else LD2D((void*)st, &d); - *(long double*)mystack = (long double)d; + ld = d; + if(((uintptr_t)mystack)&0xf) // align the long double + mystack++; + memcpy(mystack, &ld, 16); st+=3; mystack+=2; #endif state = 0; @@ -927,7 +931,10 @@ void myStackAlignW32(const char* fmt, uint32_t* st, uint64_t* mystack) st+=3; mystack+=2; #else LD2D((void*)st, &d); - *(long double*)mystack = (long double)d; + if(((uintptr_t)mystack)&0xf) // align the long double + mystack++; + ld = d; + memcpy(mystack, &ld, 16); st+=3; mystack+=2; #endif state = 0; |