Fix unsigned_abs function on Unix (dotnet/coreclr#8805)
authorJan Vorlicek <janvorli@microsoft.com>
Thu, 5 Jan 2017 01:37:25 +0000 (02:37 +0100)
committerGitHub <noreply@github.com>
Thu, 5 Jan 2017 01:37:25 +0000 (02:37 +0100)
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

src/coreclr/src/jit/jit.h

index 220294f..c485ff0 100644 (file)
@@ -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_