arm double to (unsigned) long long conversion

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.low = 1 << exp; \
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.low >> (32 - high_shift); \
} else \

View File

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

View File

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