* 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 -
This commit is contained in:
sergei 2016-02-14 10:29:11 +00:00
parent 41751bc5b4
commit 161f812113

View File

@ -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 } 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 } (longint(-AValue) shr (sizeof(AValue)*8-1)) { gives 1 for positive values, 0 otherwise }
); );
end; end;