msvcrt: Convert double (numerically) to UINT64 via INT64, fixing pow() on arm

System Internals / WINE - Martin Storsjo [martin.st] - 28 July 2021 20:07 UTC

If converting a negative double to an UINT64, on arm it's clipped to zero instead of converted to its two's complement form (contrary to x86).

This fixes cases like pow(2.0, -2.0) on arm/aarch64. Add similar casts to expf() too which seems to have a similar pattern, even if it's not known if that case can cause issues or not.

In the original musl source, the converttoint() function returns a signed int32_t, doing the same double->signed->unsigned conversion, implicitly.

37b896db48f msvcrt: Convert double (numerically) to UINT64 via INT64, fixing pow() on arm.
dlls/msvcrt/math.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

Upstream: source.winehq.org


  • Share