mirror of
https://github.com/TinyCC/tinycc.git
synced 2025-11-16 04:24:45 +00:00
arm double to (unsigned) long long conversion
Bug found with openssl test suite.
This commit is contained in:
@@ -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 \
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1 +1,2 @@
|
||||
42
|
||||
1234567890
|
||||
|
||||
Reference in New Issue
Block a user