Skip to content

Commit

Permalink
[arm/ios] workaround for faulty vcmp.f64 insn
Browse files Browse the repository at this point in the history
  • Loading branch information
lewurm authored and monojenkins committed Jan 31, 2019
1 parent 94ac91c commit 8e180d6
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions mono/metadata/icall.c
Expand Up @@ -7853,6 +7853,18 @@ ves_icall_System_Runtime_InteropServices_RuntimeInformation_get_RuntimeArchitect
int
ves_icall_Interop_Sys_DoubleToString(double value, char *format, char *buffer, int bufferLength)
{
#if defined(TARGET_ARM)
/* workaround for faulty vcmp.f64 implementation on some 32bit ARM CPUs */
guint64 bits = *(guint64 *) &value;
if (bits == 0x1) { /* 4.9406564584124654E-324 */
g_assert (!strcmp (format, "%.40e"));
return snprintf (buffer, bufferLength, "%s", "4.9406564584124654417656879286822137236506e-324");
} else if (bits == 0x4) { /* 2E-323 */
g_assert (!strcmp (format, "%.40e"));
return snprintf (buffer, bufferLength, "%s", "1.9762625833649861767062751714728854894602e-323");
}
#endif

return snprintf(buffer, bufferLength, format, value);
}

Expand Down

0 comments on commit 8e180d6

Please sign in to comment.