AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

SetBit-Funktion verbessern?

Ein Thema von SirThornberry · begonnen am 10. Jul 2004 · letzter Beitrag vom 11. Jul 2004
 
Basilikum

Registriert seit: 9. Aug 2003
389 Beiträge
 
Delphi 7 Professional
 
#4

Re: SetBit-Funktion verbessern?

  Alt 10. Jul 2004, 20:46
Zitat von negaH:
Delphi-Quellcode:
function BitSet(Value,BitIndex: LongWord; State: Boolean): LondWord;
asm
    shr ecx, 1
    btc eax, edx
end;

procedure BitSet(var Value: LongWord; BitIndex: LongWord; State: Boolean);
asm
    shr ecx, 1
    btc dword ptr [eax], edx
end;
dies setzt jedoch voraus, dass das betroffene Bit nicht bereits 1 war...
Zitat von intel 8086 Family Architecture:
The destination bit indexed by the source value is copied into the Carry Flag after being complimented (inverted).
also ist doch ein Compare notwendig:

Delphi-Quellcode:
Function BitSet(Const Value : LongWord;Const Bit : Byte;Const State : Boolean) : LongWord;
Asm
  OR CL,CL
  JNZ @@True

  BTR EAX,EDX
  RET

@@True:
  BTS EAX,EDX
end;
  Mit Zitat antworten Zitat
 


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 16:28 Uhr.
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz