History

Fix float to long long conversion on ARM

Fix float to long long conversion on ARM when the result would fit in an int.

Thomas Preud'homme committed 12 years ago

Commit 0ab07f31 parent 02d2ca81 file · +8 −8Browse files

Unified · Split

lib/armeabi.c+8−8
@@ -34,7 +34,7 @@ REGS_RETURN(double_unsigned_struct, double_unsigned_struct) · 33 unmodified lines
34 34
35 35
36/* float to [unsigned] long long conversion */36/* float to [unsigned] long long conversion */
37#define DEFINE__AEABIT_F2XLZ(name, with_sign) \37#define DEFINE__AEABI_F2XLZ(name, with_sign) \
38void __aeabi_ ## name(unsigned val) \38void __aeabi_ ## name(unsigned val) \
39{ \39{ \
40 int exp, high_shift, sign; \40 int exp, high_shift, sign; \
@@ -74,7 +74,7 @@ void __aeabi_ ## name(unsigned val) \ · 33 unmodified lines
74 if (exp > FLOAT_FRAC_BITS) \74 if (exp > FLOAT_FRAC_BITS) \
75 ret.low |= val << (exp - FLOAT_FRAC_BITS); \75 ret.low |= val << (exp - FLOAT_FRAC_BITS); \
76 else \76 else \
77 ret.low = val >> (FLOAT_FRAC_BITS - exp); \77 ret.low |= val >> (FLOAT_FRAC_BITS - exp); \
78 } \78 } \
79 \79 \
80 /* encode negative integer using 2's complement */ \80 /* encode negative integer using 2's complement */ \
@@ -92,13 +92,13 @@ void __aeabi_ ## name(unsigned val) \ · 11 unmodified lines
92}92}
93 93
94/* float to unsigned long long conversion */94/* float to unsigned long long conversion */
95DEFINE__AEABIT_F2XLZ(f2ulz, 0)95DEFINE__AEABI_F2XLZ(f2ulz, 0)
96 96
97/* float to long long conversion */97/* float to long long conversion */
98DEFINE__AEABIT_F2XLZ(f2lz, 1)98DEFINE__AEABI_F2XLZ(f2lz, 1)
99 99
100/* double to [unsigned] long long conversion */100/* double to [unsigned] long long conversion */
101#define DEFINE__AEABIT_D2XLZ(name, with_sign) \101#define DEFINE__AEABI_D2XLZ(name, with_sign) \
102void __aeabi_ ## name(double_unsigned_struct val) \102void __aeabi_ ## name(double_unsigned_struct val) \
103{ \103{ \
104 int exp, high_shift, sign; \104 int exp, high_shift, sign; \
@@ -143,7 +143,7 @@ void __aeabi_ ## name(double_unsigned_struct val) \ · 38 unmodified lines
143 ret.low |= val.high << high_shift; \143 ret.low |= val.high << high_shift; \
144 ret.low |= val.low >> (32 - high_shift); \144 ret.low |= val.low >> (32 - high_shift); \
145 } else \145 } else \
146 ret.low = val.high >> (DOUBLE_FRAC_BITS - 32 - exp); \146 ret.low |= val.high >> (DOUBLE_FRAC_BITS - 32 - exp); \
147 } \147 } \
148 \148 \
149 /* encode negative integer using 2's complement */ \149 /* encode negative integer using 2's complement */ \
@@ -161,10 +161,10 @@ void __aeabi_ ## name(double_unsigned_struct val) \ · 11 unmodified lines
161}161}
162 162
163/* double to unsigned long long conversion */163/* double to unsigned long long conversion */
164DEFINE__AEABIT_D2XLZ(d2ulz, 0)164DEFINE__AEABI_D2XLZ(d2ulz, 0)
165 165
166/* double to long long conversion */166/* double to long long conversion */
167DEFINE__AEABIT_D2XLZ(d2lz, 1)167DEFINE__AEABI_D2XLZ(d2lz, 1)
168 168
169/* long long to float conversion */169/* long long to float conversion */
170#define DEFINE__AEABI_XL2F(name, with_sign) \170#define DEFINE__AEABI_XL2F(name, with_sign) \

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t