Prechádzať zdrojové kódy

* Explicitly typecast (-longint) to longint, otherwise it becomes an int64 on 64-bit targets, causing wrong result of sign(longint). Mantis #29649.

git-svn-id: trunk@33096 -
sergei 9 rokov pred
rodič
commit
161f812113
1 zmenil súbory, kde vykonal 2 pridanie a 2 odobranie
  1. 2 2
      rtl/objpas/math.pp

+ 2 - 2
rtl/objpas/math.pp

@@ -641,8 +641,8 @@ function Sign(const AValue: Integer): TValueSign;inline;
 
 
 begin
 begin
   result:=TValueSign(
   result:=TValueSign(
-    SarLongint(AValue,sizeof(AValue)*8-1) or   { gives -1 for negative values, 0 otherwise }
-    (-AValue shr (sizeof(AValue)*8-1))         { gives 1 for positive values, 0 otherwise }
+    SarLongint(AValue,sizeof(AValue)*8-1) or            { gives -1 for negative values, 0 otherwise }
+    (longint(-AValue) shr (sizeof(AValue)*8-1))         { gives 1 for positive values, 0 otherwise }
   );
   );
 end;
 end;