mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-25 10:42:20 -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);
|
||||
end;
|
||||
|
||||
function ps_inttohex(value : integer) : string;
|
||||
function ps_inttohex(value : integer) : string; extdecl;
|
||||
begin
|
||||
result := IntToHex(value,1);
|
||||
end;
|
||||
|
||||
function ps_hextoint(hex : string) : integer;
|
||||
function ps_hextoint(hex : string) : integer;extdecl;
|
||||
begin
|
||||
result := StrToInt('$' + hex);
|
||||
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_inttohex,'function IntToHex(number : integer) : string');
|
||||
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}
|
||||
SetCurrSection('Window');
|
||||
AddFunction(@ps_Freeze, 'function Freeze: boolean;');
|
||||
|
Loading…
Reference in New Issue
Block a user