Skip to content

Commit 199e135

Browse files
committed
arm double to (unsigned) long long conversion
Bug found with openssl test suite.
1 parent f8eb5f4 commit 199e135

File tree

3 files changed

+4
-1
lines changed

3 files changed

+4
-1
lines changed

lib/armeabi.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ void __aeabi_ ## name(double_unsigned_struct val) \
177177
ret.high = 0; \
178178
ret.low = 1 << exp; \
179179
if (exp > DOUBLE_FRAC_BITS - 32) { \
180-
high_shift = exp - DOUBLE_FRAC_BITS - 32; \
180+
high_shift = exp - (DOUBLE_FRAC_BITS - 32); \
181181
ret.low |= val.high << high_shift; \
182182
ret.low |= val.low >> (32 - high_shift); \
183183
} else \

tests/tests2/111_conversion.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@ conv (union u *p)
1414
int main (void)
1515
{
1616
union u v;
17+
double d = 1234567890.0;
1718

1819
v.ld = 42;
1920
conv (&v);
2021
printf ("%lu\n", v.ul);
22+
printf ("%llu\n", (unsigned long long)d);
2123
return 0;
2224
}

tests/tests2/111_conversion.expect

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
42
2+
1234567890

0 commit comments

Comments
 (0)