From fdf58bc1b0e3906c5a3fba0017ea8f2f9887a892 Mon Sep 17 00:00:00 2001 From: Hyeongseok Oh Date: Tue, 16 Aug 2016 19:22:06 +0900 Subject: fix for correct conversion from negative double to unsigned long in ARM --- src/vm/jithelpers.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/vm/jithelpers.cpp') diff --git a/src/vm/jithelpers.cpp b/src/vm/jithelpers.cpp index 1626810758..1f7c63035d 100644 --- a/src/vm/jithelpers.cpp +++ b/src/vm/jithelpers.cpp @@ -588,8 +588,17 @@ FORCEINLINE INT64 FastDbl2Lng(double val) FCALL_CONTRACT; return HCCALL1_V(JIT_Dbl2Lng, val); #else +// In x86/x64, conversion result of negative double to unsigned integer is +// bit-equivalent unsigned value. +// But other architecture's compiler convert negative doubles to zero when +// the target is unsigned. +#ifdef _TARGET_XARCH_ FCALL_CONTRACT; return((__int64) val); +#else + FCALL_CONTRACT; + return((unsigned __int64) val); +#endif #endif } -- cgit v1.2.3