mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-25 18:52:15 -05:00
Added Sar,Ror and Rol for bitwise operations.
This commit is contained in:
parent
b10ecdc9ff
commit
db2c2d3b72
@ -164,12 +164,26 @@ begin
|
|||||||
result := ln(x);
|
result := ln(x);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ps_inttohex(value : integer) : string;
|
function ps_inttohex(value : integer) : string; extdecl;
|
||||||
begin
|
begin
|
||||||
result := IntToHex(value,1);
|
result := IntToHex(value,1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function ps_hextoint(hex : string) : integer;
|
function ps_hextoint(hex : string) : integer;extdecl;
|
||||||
begin
|
begin
|
||||||
result := StrToInt('$' + hex);
|
result := StrToInt('$' + hex);
|
||||||
end;
|
end;
|
||||||
|
function ps_sar(AValue : longint; shift : byte) : longint; extdecl;
|
||||||
|
begin;
|
||||||
|
Shift:=Shift and 31;
|
||||||
|
Result:=longint(dword(dword(dword(AValue) shr Shift) or (dword(longint(dword(0-dword(dword(AValue) shr 31)) and dword(longint(0-(ord(Shift<>0){ and 1}))))) shl (32-Shift))));
|
||||||
|
end;
|
||||||
|
function ps_ror(num : longword; shift : byte) : LongWord; extdecl;
|
||||||
|
begin
|
||||||
|
result := RorDWord(num,shift);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function ps_rol(num : longword; shift : byte) : LongWord; extdecl;
|
||||||
|
begin
|
||||||
|
result := RolDWord(num,shift);
|
||||||
|
end;
|
||||||
|
@ -73,7 +73,9 @@ AddFunction(@ps_logn,'function logn(base, x : extended): extended;');
|
|||||||
AddFunction(@ps_ln,'function ln(x : extended) : extended;');
|
AddFunction(@ps_ln,'function ln(x : extended) : extended;');
|
||||||
AddFunction(@ps_inttohex,'function IntToHex(number : integer) : string');
|
AddFunction(@ps_inttohex,'function IntToHex(number : integer) : string');
|
||||||
AddFunction(@ps_hextoint,'function HexToInt(Hex : string) : integer');
|
AddFunction(@ps_hextoint,'function HexToInt(Hex : string) : integer');
|
||||||
|
AddFunction(@ps_sar,'function sar(AValue : longint; shift : byte) : longint;');
|
||||||
|
AddFunction(@ps_ror,'function ror(num : longword; shift : byte) : LongWord;');
|
||||||
|
AddFunction(@ps_rol,'function rol(num : longword; shift : byte) : LongWord;');
|
||||||
{window}
|
{window}
|
||||||
SetCurrSection('Window');
|
SetCurrSection('Window');
|
||||||
AddFunction(@ps_Freeze, 'function Freeze: boolean;');
|
AddFunction(@ps_Freeze, 'function Freeze: boolean;');
|
||||||
|
Loading…
Reference in New Issue
Block a user