RTL: Sqrt & Pow
This commit is contained in:
+21
-1
@@ -78,6 +78,7 @@ type
|
||||
TNativeFunc_O_O = function(A: Int64): Int64;
|
||||
TNativeFunc_F_F = function(A: Double): Double;
|
||||
TNativeFunc_F_O = function(A: Double): Int64;
|
||||
TNativeFunc_O_F = function(A: Int64): Double;
|
||||
|
||||
TNativeFunc_OO_O = function(A, B: Int64): Int64;
|
||||
TNativeFunc_OO_F = function(A, B: Int64): Double;
|
||||
@@ -101,6 +102,7 @@ type
|
||||
class function CreateWrapper_O_O(CodeAddress: Pointer): TDataValue.TFunc; static;
|
||||
class function CreateWrapper_F_F(CodeAddress: Pointer): TDataValue.TFunc; static;
|
||||
class function CreateWrapper_F_O(CodeAddress: Pointer): TDataValue.TFunc; static;
|
||||
class function CreateWrapper_O_F(CodeAddress: Pointer): TDataValue.TFunc; static;
|
||||
class function CreateWrapper_OO_O(CodeAddress: Pointer): TDataValue.TFunc; static;
|
||||
class function CreateWrapper_OO_F(CodeAddress: Pointer): TDataValue.TFunc; static;
|
||||
class function CreateWrapper_FF_F(CodeAddress: Pointer): TDataValue.TFunc; static;
|
||||
@@ -546,6 +548,20 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TRtlRegistry.CreateWrapper_O_F(CodeAddress: Pointer): TDataValue.TFunc;
|
||||
begin
|
||||
Result :=
|
||||
function(const Args: TArray<TDataValue>): TDataValue
|
||||
var
|
||||
A: Int64;
|
||||
Res: Double;
|
||||
begin
|
||||
A := Args[0].AsScalar.Value.AsInt64;
|
||||
Res := TNativeFunc_O_F(CodeAddress)(A);
|
||||
Result := TDataValue(TScalar.FromDouble(Res));
|
||||
end;
|
||||
end;
|
||||
|
||||
class function TRtlRegistry.CreateWrapper_OO_O(CodeAddress: Pointer): TDataValue.TFunc;
|
||||
begin
|
||||
Result :=
|
||||
@@ -703,6 +719,8 @@ begin
|
||||
Result := CreateWrapper_F_F(ptr)
|
||||
else if (argTypes[0].Kind = stFloat) and (retType.Kind = stOrdinal) then
|
||||
Result := CreateWrapper_F_O(ptr)
|
||||
else if (argTypes[0].Kind = stOrdinal) and (retType.Kind = stFloat) then
|
||||
Result := CreateWrapper_O_F(ptr)
|
||||
else if (argTypes[0].Kind = stUnknown) and (rttiParams[0].ParamType.Handle = TypeInfo(TScalar)) then
|
||||
begin
|
||||
// This is the wrapper for: class function(Arg: TScalar): TScalar;
|
||||
@@ -767,7 +785,9 @@ begin
|
||||
begin
|
||||
Result := CreateWrapper_TT_T(ptr); // e.g. String concat
|
||||
end
|
||||
end;
|
||||
end
|
||||
else
|
||||
Assert(false, 'fgdfdf');
|
||||
end;
|
||||
|
||||
procedure RegisterRtlFunctions(const AScope: IExecutionScope);
|
||||
|
||||
Reference in New Issue
Block a user