Results 1 to 10 of 25

Thread: C to Pascal conversion hq2x

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #24

    C to Pascal conversion hq2x

    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;
    Last edited by Jimmy Valavanis; 30-03-2012 at 04:10 PM.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •