Skip to content

Commit 1320457

Browse files
lewurmmarek-safar
authored andcommitted
[arm/ios] workaround for faulty vcmp.f64 insn
Fixes #11965
1 parent 2359cba commit 1320457

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

‎mono/metadata/icall.c‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7897,6 +7897,18 @@ ves_icall_System_Runtime_InteropServices_Marshal_PrelinkAll (MonoReflectionTypeH
78977897
ICALL_EXPORT int
78987898
ves_icall_Interop_Sys_DoubleToString(double value, char *format, char *buffer, int bufferLength)
78997899
{
7900+
#if defined(TARGET_ARM)
7901+
/* workaround for faulty vcmp.f64 implementation on some 32bit ARM CPUs */
7902+
guint64 bits = *(guint64 *) &value;
7903+
if (bits == 0x1) { /* 4.9406564584124654E-324 */
7904+
g_assert (!strcmp (format, "%.40e"));
7905+
return snprintf (buffer, bufferLength, "%s", "4.9406564584124654417656879286822137236506e-324");
7906+
} else if (bits == 0x4) { /* 2E-323 */
7907+
g_assert (!strcmp (format, "%.40e"));
7908+
return snprintf (buffer, bufferLength, "%s", "1.9762625833649861767062751714728854894602e-323");
7909+
}
7910+
#endif
7911+
79007912
return snprintf(buffer, bufferLength, format, value);
79017913
}
79027914

0 commit comments

Comments
 (0)