From: Jan Vorlicek Date: Thu, 5 Jan 2017 01:37:25 +0000 (+0100) Subject: Fix unsigned_abs function on Unix (dotnet/coreclr#8805) X-Git-Tag: submit/tizen/20210909.063632~11030^2~8515 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=135f9ce75cbacf4362cd9c659689c87b170a3d1d;p=platform%2Fupstream%2Fdotnet%2Fruntime.git Fix unsigned_abs function on Unix (dotnet/coreclr#8805) The unsigned_abs function in jit.h is implemented using labs function. However labs has 32 bit argument / result, while the unsigned_abs expects it to be 64 bit. The correct function to use for FEATURE_PAL is llabs. But since we now have abs overload for __int64 in pal.h, we can just remove the #ifdef for FEATURE_PAL and use the same implementation for both Unix and Windows. Commit migrated from https://github.com/dotnet/coreclr/commit/d2daeccabf5c64c67a080928fc48a4d18d0464f9 --- diff --git a/src/coreclr/src/jit/jit.h b/src/coreclr/src/jit/jit.h index 220294f..c485ff0 100644 --- a/src/coreclr/src/jit/jit.h +++ b/src/coreclr/src/jit/jit.h @@ -699,11 +699,7 @@ inline unsigned int unsigned_abs(int x) #ifdef _TARGET_64BIT_ inline size_t unsigned_abs(ssize_t x) { -#ifndef FEATURE_PAL return ((size_t)abs(x)); -#else // !FEATURE_PAL - return ((size_t)labs(x)); -#endif // !FEATURE_PAL } #endif // _TARGET_64BIT_