arm double to (unsigned) long long conversion
Some checks failed
build and test / test-x86_64-linux (push) Has been cancelled
build and test / test-x86_64-osx (push) Has been cancelled
build and test / test-aarch64-osx (push) Has been cancelled
build and test / test-x86_64-win32 (push) Has been cancelled
build and test / test-i386-win32 (push) Has been cancelled
build and test / test-armv7-linux (push) Has been cancelled
build and test / test-aarch64-linux (push) Has been cancelled
build and test / test-riscv64-linux (push) Has been cancelled

Bug found with openssl test suite.
This commit is contained in:
herman ten brugge 2025-08-17 08:49:29 +02:00
parent f8eb5f4ab8
commit 199e135142
3 changed files with 4 additions and 1 deletions

View File

@ -177,7 +177,7 @@ void __aeabi_ ## name(double_unsigned_struct val) \
ret.high = 0; \ ret.high = 0; \
ret.low = 1 << exp; \ ret.low = 1 << exp; \
if (exp > DOUBLE_FRAC_BITS - 32) { \ if (exp > DOUBLE_FRAC_BITS - 32) { \
high_shift = exp - DOUBLE_FRAC_BITS - 32; \ high_shift = exp - (DOUBLE_FRAC_BITS - 32); \
ret.low |= val.high << high_shift; \ ret.low |= val.high << high_shift; \
ret.low |= val.low >> (32 - high_shift); \ ret.low |= val.low >> (32 - high_shift); \
} else \ } else \

View File

@ -14,9 +14,11 @@ conv (union u *p)
int main (void) int main (void)
{ {
union u v; union u v;
double d = 1234567890.0;
v.ld = 42; v.ld = 42;
conv (&v); conv (&v);
printf ("%lu\n", v.ul); printf ("%lu\n", v.ul);
printf ("%llu\n", (unsigned long long)d);
return 0; return 0;
} }

View File

@ -1 +1,2 @@
42 42
1234567890