Einzelnen Beitrag anzeigen

Benutzerbild von Neutral General
Neutral General

Registriert seit: 16. Jan 2004
Ort: Bendorf
5.219 Beiträge
 
Delphi 10.2 Tokyo Professional
 
#2

AW: RotateLeft: 32-Bit Integer rotieren

  Alt 17. Aug 2011, 09:34
Hallo,

So gehts:
Delphi-Quellcode:
asm
  mov cl, bits
  mov eax, zahl
  rol eax, cl
  mov zahl, eax
end;
Oder so:
Delphi-Quellcode:
function rol(Zahl: Integer; Bits: Byte): Integer;
asm
  xchg cl,dl
  rol eax, cl
end;
Delphi-Quellcode:
var zahl: UInt32;
    bits: UInt8;
begin
  Zahl := $80000000;
  bits := 1;
  Caption := IntToStr(rol(Zahl,bits));
end;
Michael
"Programmers talk about software development on weekends, vacations, and over meals not because they lack imagination,
but because their imagination reveals worlds that others cannot see."

Geändert von Neutral General (17. Aug 2011 um 09:43 Uhr)
  Mit Zitat antworten Zitat