소스 검색

* in SysUtils.DecodeDate(), cast the result of trunc() to longint (trunc
normally returns int64 in FPC), before performing any further calculations -
the result always fits in a longint (the date is range checked against
MaxDateTime and that is well within longint limits). This generates faster
code on non 64-bit targets and also fixes i8086 compilation, which previously
failed on register allocation on this function.

git-svn-id: trunk@33946 -

nickysn 9 년 전
부모
커밋
c205cb03c8
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  1. 1 1
      rtl/objpas/sysutils/dati.inc

+ 1 - 1
rtl/objpas/sysutils/dati.inc

@@ -167,7 +167,7 @@ begin
     if Date>MaxDateTime then
     if Date>MaxDateTime then
       Date:=MaxDateTime;
       Date:=MaxDateTime;
 //       Raise EConvertError.CreateFmt('%f is not a valid TDatetime encoding, maximum value is %f.',[Date,MaxDateTime]);
 //       Raise EConvertError.CreateFmt('%f is not a valid TDatetime encoding, maximum value is %f.',[Date,MaxDateTime]);
-    j := pred((Trunc(System.Int(Date)) + 693900) SHL 2);
+    j := pred((longint(Trunc(System.Int(Date))) + 693900) SHL 2);
     ly:= j DIV 146097;
     ly:= j DIV 146097;
     j:= j - 146097 * cardinal(ly);
     j:= j - 146097 * cardinal(ly);
     ld := j SHR 2;
     ld := j SHR 2;