the code posted will compile only on x86 or x86-64 cpu architectures...
The following code will compile also on non x86 machines:
Code:
// Left shift between integers
function _SHL(const x: integer; const bits: integer): integer;
begin
result := x * (1 shl bits);
end;
// Left shift between longwords
function _SHLW(const x: LongWord; const bits: LongWord): LongWord;
begin
result := x shl bits;
end;
// Right shift between integers
function _SHR(const x: integer; const bits: integer): integer;
begin
result := x div (1 shl bits);
end;
// Right shift between longwords
function _SHRW(const x: LongWord; const bits: LongWord): LongWord;
begin
result := x shr bits;
end;
Bookmarks