Einzelnen Beitrag anzeigen

Blup

Registriert seit: 7. Aug 2008
Ort: Brandenburg
1.429 Beiträge
 
Delphi 10.4 Sydney
 
#5

AW: Problem mit Enumeration

  Alt 14. Mär 2016, 08:28
Dir ist klar das Random(255) nur Zahlen im Bereich 0..254 erzeugt?
Delphi-Quellcode:
function Get_a_Bit(const AValue: Cardinal; const Bit: Byte): Boolean; overload;
function Get_a_Bit(const AValue: Cardinal; const Bit: THanID): Boolean; overload;

implementation

function Get_a_Bit(const AValue: Cardinal; const Bit: Byte): Boolean;
begin
  Result := (AValue and (1 shl Bit)) <> 0;
end;

function Get_a_Bit(const AValue: Cardinal; const Bit: THanID): Boolean;
begin
  Result := Get_a_Bit(AValue, Ord(Bit));
end;
  Mit Zitat antworten Zitat