Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.199 Beiträge
 
Delphi 12 Athens
 
#7

Re: Delphi Compiler - Mengen und Aufzählungstypen?? [INTERN]

  Alt 20. Feb 2010, 20:15
Wie sieht denn deine Speicherverwaltung aus?
Bzw, wenn du auf reale SETs zugreifen willst, dann bleibt dann eh kein anderer Weg

abfragen:
Delphi-Quellcode:
if count <= 8 then result := ($1 shl value) and PByte(@data) <> 0
else if count <= 16 then result := ($1 shl value) and PWord(@data) <> 0
else result := ($1 shl (value mod 32)) and PLongWord(@data)[value div 32] <> 0;
   //result := ($1 shl (value and 31)) and PLongWord(@data)[value shr 5] <> 0;
OK, Byteweise ginge auch, auch wenn nicht unbedingt efektiv:
Delphi-Quellcode:
result := ($1 shl (value mod 8)) and PByte(@data)[value div 8] <> 0;
//result := ($1 shl (value and 7)) and PByte(@data)[value shr 3] <> 0;

entfernen (ohne "or i") und setzen (mit "or i"):
Delphi-Quellcode:
if count <= 8 then begin
  i := 1 shl value;
  PByte(@data) := (PByte(@data) and not i) or i;
end else if count <= 16 then begin
  i := 1 shl value;
  PWord(@data) := (PWord(@data) and not i) or i;
end else begin
  i := 1 shl (value mod 32);
  i2 := value div 32;
  PLongWord(@data)[i2] := (PLongWord(@data)[i2] and not i) or i;
  //i := 1 shl (value and 31);
  //i2 := value shr 5;
  //PLongWord(@data)[i2] := (PLongWord(@data)[i2] and not i) or i;
end;
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat