RTL enhancements

This commit is contained in:
Michael Schimmel
2025-09-19 15:10:24 +02:00
parent c31985935c
commit 28558614f0
2 changed files with 11 additions and 11 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
<ProjectVersion>20.3</ProjectVersion>
<FrameworkType>FMX</FrameworkType>
<Base>True</Base>
<Config Condition="'$(Config)'==''">Release</Config>
<Config Condition="'$(Config)'==''">Debug</Config>
<Platform Condition="'$(Platform)'==''">Win64</Platform>
<ProjectName Condition="'$(ProjectName)'==''">ASTPlayground</ProjectName>
<TargetedPlatforms>2</TargetedPlatforms>
+10 -10
View File
@@ -16,19 +16,19 @@ type
TRtlFunctions = record
public
[TRtlFunction('Abs')]
class function Abs(Arg: TScalar): TScalar; static;
class function Abs(const Arg: TScalar): TScalar; static;
[TRtlFunction('Trunc')]
class function Trunc(Arg: TScalar): TScalar; static;
class function Trunc(const Arg: TScalar): TScalar; static;
[TRtlFunction('Ceil')]
class function Ceil(Arg: TScalar): TScalar; static;
class function Ceil(const Arg: TScalar): TScalar; static;
[TRtlFunction('Floor')]
class function Floor(Arg: TScalar): TScalar; static;
class function Floor(const Arg: TScalar): TScalar; static;
[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.
// The registry is smart enough to handle both native types and the TDataValue signature directly.
@@ -56,7 +56,7 @@ uses
System.Math,
Myc.Data.Decimal;
class function TRtlFunctions.Abs(Arg: TScalar): TScalar;
class function TRtlFunctions.Abs(const Arg: TScalar): TScalar;
begin
case Arg.Kind of
skInteger: Result := TScalar.FromInteger(System.Abs(Arg.Value.AsInteger));
@@ -70,7 +70,7 @@ begin
end;
end;
class function TRtlFunctions.Trunc(Arg: TScalar): TScalar;
class function TRtlFunctions.Trunc(const Arg: TScalar): TScalar;
begin
case Arg.Kind of
skInteger, skInt64: Result := Arg; // Trunc on an integer is a no-op
@@ -82,7 +82,7 @@ begin
end;
end;
class function TRtlFunctions.Ceil(Arg: TScalar): TScalar;
class function TRtlFunctions.Ceil(const Arg: TScalar): TScalar;
begin
case Arg.Kind of
skInteger, skInt64: Result := Arg; // Ceil on an integer is a no-op
@@ -94,7 +94,7 @@ begin
end;
end;
class function TRtlFunctions.Floor(Arg: TScalar): TScalar;
class function TRtlFunctions.Floor(const Arg: TScalar): TScalar;
begin
case Arg.Kind of
skInteger, skInt64: Result := Arg; // Floor on an integer is a no-op
@@ -106,7 +106,7 @@ begin
end;
end;
class function TRtlFunctions.Sign(Arg: TScalar): TScalar;
class function TRtlFunctions.Sign(const Arg: TScalar): TScalar;
begin
case Arg.Kind of
skInteger: Result := TScalar.FromInteger(System.Math.Sign(Arg.Value.AsInteger));