RTL enhancements
This commit is contained in:
@@ -4,7 +4,7 @@
|
|||||||
<ProjectVersion>20.3</ProjectVersion>
|
<ProjectVersion>20.3</ProjectVersion>
|
||||||
<FrameworkType>FMX</FrameworkType>
|
<FrameworkType>FMX</FrameworkType>
|
||||||
<Base>True</Base>
|
<Base>True</Base>
|
||||||
<Config Condition="'$(Config)'==''">Release</Config>
|
<Config Condition="'$(Config)'==''">Debug</Config>
|
||||||
<Platform Condition="'$(Platform)'==''">Win64</Platform>
|
<Platform Condition="'$(Platform)'==''">Win64</Platform>
|
||||||
<ProjectName Condition="'$(ProjectName)'==''">ASTPlayground</ProjectName>
|
<ProjectName Condition="'$(ProjectName)'==''">ASTPlayground</ProjectName>
|
||||||
<TargetedPlatforms>2</TargetedPlatforms>
|
<TargetedPlatforms>2</TargetedPlatforms>
|
||||||
|
|||||||
@@ -16,19 +16,19 @@ type
|
|||||||
TRtlFunctions = record
|
TRtlFunctions = record
|
||||||
public
|
public
|
||||||
[TRtlFunction('Abs')]
|
[TRtlFunction('Abs')]
|
||||||
class function Abs(Arg: TScalar): TScalar; static;
|
class function Abs(const Arg: TScalar): TScalar; static;
|
||||||
|
|
||||||
[TRtlFunction('Trunc')]
|
[TRtlFunction('Trunc')]
|
||||||
class function Trunc(Arg: TScalar): TScalar; static;
|
class function Trunc(const Arg: TScalar): TScalar; static;
|
||||||
|
|
||||||
[TRtlFunction('Ceil')]
|
[TRtlFunction('Ceil')]
|
||||||
class function Ceil(Arg: TScalar): TScalar; static;
|
class function Ceil(const Arg: TScalar): TScalar; static;
|
||||||
|
|
||||||
[TRtlFunction('Floor')]
|
[TRtlFunction('Floor')]
|
||||||
class function Floor(Arg: TScalar): TScalar; static;
|
class function Floor(const Arg: TScalar): TScalar; static;
|
||||||
|
|
||||||
[TRtlFunction('Sign')]
|
[TRtlFunction('Sign')]
|
||||||
class function Sign(Arg: TScalar): TScalar; static;
|
class function Sign(const Arg: TScalar): TScalar; static;
|
||||||
|
|
||||||
// NOTE: Higher-order and complex functions can keep the TDataValue signature for now.
|
// NOTE: Higher-order and complex functions can keep the TDataValue signature for now.
|
||||||
// The registry is smart enough to handle both native types and the TDataValue signature directly.
|
// The registry is smart enough to handle both native types and the TDataValue signature directly.
|
||||||
@@ -56,7 +56,7 @@ uses
|
|||||||
System.Math,
|
System.Math,
|
||||||
Myc.Data.Decimal;
|
Myc.Data.Decimal;
|
||||||
|
|
||||||
class function TRtlFunctions.Abs(Arg: TScalar): TScalar;
|
class function TRtlFunctions.Abs(const Arg: TScalar): TScalar;
|
||||||
begin
|
begin
|
||||||
case Arg.Kind of
|
case Arg.Kind of
|
||||||
skInteger: Result := TScalar.FromInteger(System.Abs(Arg.Value.AsInteger));
|
skInteger: Result := TScalar.FromInteger(System.Abs(Arg.Value.AsInteger));
|
||||||
@@ -70,7 +70,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TRtlFunctions.Trunc(Arg: TScalar): TScalar;
|
class function TRtlFunctions.Trunc(const Arg: TScalar): TScalar;
|
||||||
begin
|
begin
|
||||||
case Arg.Kind of
|
case Arg.Kind of
|
||||||
skInteger, skInt64: Result := Arg; // Trunc on an integer is a no-op
|
skInteger, skInt64: Result := Arg; // Trunc on an integer is a no-op
|
||||||
@@ -82,7 +82,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TRtlFunctions.Ceil(Arg: TScalar): TScalar;
|
class function TRtlFunctions.Ceil(const Arg: TScalar): TScalar;
|
||||||
begin
|
begin
|
||||||
case Arg.Kind of
|
case Arg.Kind of
|
||||||
skInteger, skInt64: Result := Arg; // Ceil on an integer is a no-op
|
skInteger, skInt64: Result := Arg; // Ceil on an integer is a no-op
|
||||||
@@ -94,7 +94,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TRtlFunctions.Floor(Arg: TScalar): TScalar;
|
class function TRtlFunctions.Floor(const Arg: TScalar): TScalar;
|
||||||
begin
|
begin
|
||||||
case Arg.Kind of
|
case Arg.Kind of
|
||||||
skInteger, skInt64: Result := Arg; // Floor on an integer is a no-op
|
skInteger, skInt64: Result := Arg; // Floor on an integer is a no-op
|
||||||
@@ -106,7 +106,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
class function TRtlFunctions.Sign(Arg: TScalar): TScalar;
|
class function TRtlFunctions.Sign(const Arg: TScalar): TScalar;
|
||||||
begin
|
begin
|
||||||
case Arg.Kind of
|
case Arg.Kind of
|
||||||
skInteger: Result := TScalar.FromInteger(System.Math.Sign(Arg.Value.AsInteger));
|
skInteger: Result := TScalar.FromInteger(System.Math.Sign(Arg.Value.AsInteger));
|
||||||
|
|||||||
Reference in New Issue
Block a user