mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-04-23 02:29:34 +02:00
* 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 -
This commit is contained in:
parent
cf6c7a0a1d
commit
c205cb03c8
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user