Kaynağa Gözat

* 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 yıl önce
ebeveyn
işleme
c205cb03c8
1 değiştirilmiş dosya ile 1 ekleme ve 1 silme
  1. 1 1
      rtl/objpas/sysutils/dati.inc

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

@@ -167,7 +167,7 @@ begin
     if Date>MaxDateTime then
       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;
     j:= j - 146097 * cardinal(ly);
     ld := j SHR 2;